Standard library / math/big
big.Float.Text()
Format using a selected verb and precision; negative precision requests a shortest representation for applicable formats. Expected stdout: '1.2500\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Float) Text(format byte, prec int) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| format | byte | Formatting verb. |
| prec | int | Formatting precision. |
Return Value
string
Returns the result described above; see the example for the observed behavior.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { fmt.Println(big.NewFloat(1.25).Text('f', 4))}