Standard library / math/big
big.Float.MarshalText()
Encode the full numeric value as text, without precision, rounding mode or accuracy metadata. Expected stdout: '1.25\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Float) MarshalText() (text []byte, err error)Return Value
(text []byte, err error)
Returns the result described above; see the example for the observed behavior.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func check(err error) { if err != nil { panic(err) }}func main() { b, e := big.NewFloat(1.25).MarshalText() check(e) fmt.Println(string(b))}