Standard library / math/big
big.Float.Format()
Implement fmt.Formatter for floating-point verbs, width and flags. Use fmt.Printf rather than constructing fmt.State yourself. Expected stdout: '00001.25\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Float) Format(s fmt.State, format rune)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | fmt.State | Text input or formatting/scanning state, according to the signature. |
| format | rune | Formatting verb. |
Return Value
void
No return value; invoked by fmt.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { fmt.Printf("%08.2f\n", big.NewFloat(1.25))}