SplitScript reference / Float / sqrt

Float.sqrt

Method

T.sqrt() -> T where T: Float

Returns the principal square root of this value.

Positive finite values produce a non-negative result. Positive infinity remains infinity, signed zero preserves its sign, and a negative value other than negative zero produces NaN. Existing NaN values remain NaN.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Measure a two-dimensional distance

let distance = (3.0 * 3.0 + 4.0 * 4.0).sqrt()