Math module

sqrt

procedure · 2 overloadsSource

The square root of x as a float or float64, correctly rounded. A negative argument gives NaN; sqrt(-0.0) is -0.0 and sqrt(infinity) is infinity.

ExampleOpen in playground ↗
assert(sqrt(9.0) == 3 && sqrt(cast(float64) 2) > 1.4142 && sqrt(0.0) == 0);
assert(isnan(sqrt(-1.0)));
sqrt :: (x: float) -> float

Square root.

Parameters

x: float
the value. Negative gives NaN.

Returns

float
sqrt :: (x: float64) -> float64

Square root.

Parameters

x: float64
the value. Negative gives NaN.

Returns

float64

See also