Standard library / math/big
big.Float.Sqrt()
Compute the rounded nonnegative square root. Negative input panics; Acc is not defined for this operation. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '1.4142135624\n'.
Formal Syntax & Structure
go syntaxgo
func (z *Float) Sqrt(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() { z := new(big.Float).SetPrec(80).Sqrt(big.NewFloat(2)) fmt.Println(z.Text('f', 10))}