Standard library / math/big
big.Float.Append()
Append the Text representation to a byte buffer; retain the returned slice. Expected stdout: 'amount=1.25\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Float) Append(buf []byte, fmt byte, prec int) []byteParameters & Attributes
| Name | Type | Description |
|---|---|---|
| buf | []byte | Byte buffer or encoded data, as specified in the method contract. |
| fmt | byte | Formatting verb. |
| prec | int | Formatting precision. |
Return Value
[]byte
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(string(big.NewFloat(1.25).Append([]byte("amount="), 'f', 2)))}