Math.sqrt
Math.sqrt
Function
square root. Returns the square root of value.
Syntax
Math.sqrt(value)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| value | Number | Yes | None | The number involved in the calculation. |
Return value
| Type | Description |
|---|---|
| Int/Float | Returns the square root of value. An Int is returned for integer results, and a Float for non-integer or non-finite results. |
Example
result = Math.sqrt(9) // Output: 3 print result
Notes
- Negative square roots return NaN according to the f64 rules.