Standard library / math/big

big.Float.Int64()

Truncate toward zero to int64 with accuracy; out-of-range values saturate at the corresponding limit. Expected stdout: '3 Below\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Float) Int64() (int64, Accuracy)

Return Value

(int64, 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(3.75).Int64()  fmt.Println(v, a)}
Go Reference