Standard library / math/big

big.Float.Int()

Truncate toward zero into an optional supplied Int and report accuracy. Infinity returns nil. Expected stdout: '-2 Above\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Float) Int(z *Int) (*Int, Accuracy)

Parameters & Attributes

NameTypeDescription
z*IntOptional destination for the converted result.

Return Value

(*Int, Accuracy)

Returns the result described above; see the example for the observed behavior.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  v, a := big.NewFloat(-2.75).Int(nil)  fmt.Println(v, a)}
Go Reference