Standard library / math/big
big.Int.Float64()
Convert to nearest float64 and report accuracy rather than silently losing integer precision. Expected stdout: '9007199254740992 Below\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Int) Float64() (float64, Accuracy)Return Value
(float64, 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.NewInt(9007199254740993).Float64() fmt.Printf("%.0f %s\n", v, a)}