Standard library / math/big
big.Float.SetString()
Parse using automatic base detection; check the success flag before using the receiver, whose value is undefined on failure. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '0.125 true\n'.
Formal Syntax & Structure
go syntaxgo
func (z *Float) SetString(s string) (*Float, bool)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Text input or formatting/scanning state, according to the signature. |
Return Value
(*Float, bool)
Returns the result described above; see the example for the observed behavior.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { z, ok := new(big.Float).SetString("0.125") fmt.Println(z, ok)}