sqrt

Compute square root of x.

Special Values
xsqrt(x)invalid?
-0.0-0.0no
<0.0NaNyes
+∞+∞no
  1. float sqrt(float x)
    pragma(inline, true) @nogc @safe pure nothrow
    float
    sqrt
    (
    float x
    )
  2. double sqrt(double x)
  3. real sqrt(real x)

Examples

import std.math.operations : feqrel;
import std.math.traits : isNaN;

assert(sqrt(2.0).feqrel(1.4142) > 16);
assert(sqrt(9.0).feqrel(3.0) > 16);

assert(isNaN(sqrt(-1.0f)));
assert(isNaN(sqrt(-1.0)));
assert(isNaN(sqrt(-1.0L)));

Meta