Sqrt v0.1.0
Returns the square root.
Package: Math
Signature
func Sqrt(x: float64) -> float64;
func Sqrt(x: float32) -> float32;
Parameters
| Name | Type | Description |
|---|---|---|
x | float64 / float32 | A non-negative value. |
Returns
The non-negative square root of x, computed directly by the hardware square
root instruction and correctly rounded. Sqrt(-0.0) is -0.0; Sqrt(x) for
any other negative x is a NaN.
Example
import Math::Sqrt;
func Main() -> int {
let a = Sqrt(144.0); // 12.0
let b = Sqrt(-1.0); // NaN
return 0;
}