Standard library / math/big
big.Float.Float32()
Convert to the nearest float32 and report rounding accuracy; overflow may produce infinity and underflow may produce signed zero. Expected stdout: '16777216 Below\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Float) Float32() (float32, Accuracy)Return Value
(float32, 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(16777217).Float32() fmt.Printf("%.0f %s\n", v, a)}