Standard library / math/big

big.Float.UnmarshalText()

Parse text into the receiver under its precision settings; check the error. Text does not preserve all Float attributes. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '1.25 80\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Float) UnmarshalText(text []byte) error

Parameters & Attributes

NameTypeDescription
text[]byteEncoded textual input.

Return Value

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() {  z := new(big.Float).SetPrec(80)  check(z.UnmarshalText([]byte("1.25")))  fmt.Println(z, z.Prec())}
Go Reference