Standard library / math/bits
bits.Div()
Divides double-width (hi,lo) by y; returns quotient and remainder. Panics if y is zero or y <= hi (quotient overflow). Native uint width is architecture-dependent; local validation uses 64 bits. Expected stdout: '3 2\n'.
Formal Syntax & Structure
go syntaxgo
func Div(hi, lo, y uint) (quo, rem uint)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| hi | uint | High word of the double-width input. |
| lo | uint | Low word of the double-width input. |
| y | uint | Second input operand. |
Return Value
(quo, rem uint)
Divides double-width (hi,lo) by y; returns quotient and remainder. Panics if y is zero or y <= hi (quotient overflow). Native uint width is architecture-dependent; local validation uses 64 bits.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/bits")
func main() { q, r := bits.Div(0, 17, 5) fmt.Println(q, r)}