Standard library / math/big
big.Float.Set()
Copy the numeric value using destination precision and rounding mode; zero precision adopts source precision. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '1 2 Below\n'.
Formal Syntax & Structure
go syntaxgo
func (z *Float) Set(x *Float) *FloatParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | *Float | Numeric operand supplied to this method. |
Return Value
*Float
Returns the result described above; see the example for the observed behavior.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { x := big.NewFloat(1.25) z := new(big.Float).SetPrec(2).Set(x) fmt.Println(z, z.Prec(), z.Acc())}