Standard library / math/bits

bits.Rem()

Computes double-width dividend remainder; panics on zero divisor but not quotient overflow. Native uint width is architecture-dependent; local validation uses 64 bits. Expected stdout: '2\n'.

Formal Syntax & Structure

go syntaxgo
func Rem(hi, lo, y uint) uint

Parameters & Attributes

NameTypeDescription
hiuintHigh word of the double-width input.
louintLow word of the double-width input.
yuintSecond input operand.

Return Value

uint

Computes double-width dividend remainder; panics on zero divisor but not 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() {  fmt.Println(bits.Rem(0, 17, 5))}
Go Reference