Standard library / math/big

big.Int.Div()

Stores Euclidean quotient; corresponding modulus is nonnegative. Zero divisor panics. Expected stdout: '-3\n'.

Formal Syntax & Structure

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

Parameters & Attributes

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

Return Value

*Int

Stores Euclidean quotient; corresponding modulus is nonnegative. Zero divisor panics.

Working Example

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