Standard library / math/big

big.Float.Scan()

Implement fmt.Scanner for supported floating-point verbs. Infinity is not accepted by Scan; check scanning errors. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '1 1.25\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Float) Scan(s fmt.ScanState, ch rune) error

Parameters & Attributes

NameTypeDescription
sfmt.ScanStateText input or formatting/scanning state, according to the signature.
chruneFormat verb supplied by fmt.

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)  n, e := fmt.Sscan("1.25", z)  check(e)  fmt.Println(n, z)}
Go Reference