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) []byte

Parameters & Attributes

NameTypeDescription
buf[]byteByte buffer or encoded data, as specified in the method contract.
fmtbyteFormatting verb.
precintFormatting 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)))}
Go Reference