Standard library / math

math.Sqrt()

Nonnegative square root; negative finite input produces NaN. Expected stdout: '9\n'.

Formal Syntax & Structure

go syntaxgo
func Sqrt(x float64) float64

Parameters & Attributes

NameTypeDescription
xfloat64First input operand (or sole input if unary).

Return Value

float64

Nonnegative square root; negative finite input produces NaN.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math")
func main() {  fmt.Println(math.Sqrt(81))}
Go Reference