Standard library / math/big

big.Int.Rem()

Stores remainder for truncated quotient; sign follows dividend if nonzero. Expected stdout: '-1\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Int) Rem(x, y *Int) *Int

Parameters & Attributes

NameTypeDescription
x*IntFirst input operand (or sole input if unary).
y*IntSecond input operand.

Return Value

*Int

Stores remainder for truncated quotient; sign follows dividend if nonzero.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Println(new(big.Int).Rem(big.NewInt(-7), big.NewInt(3)))}
Go Reference