D Documentation  
sqrt
real sqrt(real x)
creal sqrt(creal x)

This function returns the square root of x.

If x<0, the function returns NaN, where INFINITY results to INFINITY.

Example:
// The compiler does not know, if you want a real or a creal when typing "9".
// This is why we use cast(float) here.

writefln("sqrt(0)    is %f",sqrt(cast(float)0));
writefln("sqrt(9)    is %f",sqrt(cast(float)9));
writefln("sqrt(INF)  is %f",sqrt(cast(float)float.infinity));
writefln("sqrt(-1)   is %f",sqrt(cast(float)-1));

Output:
sqrt(0)    is 0.000000
sqrt(9)    is 3.000000
sqrt(INF)  is inf
sqrt(-1)   is -nan

See also:
std.math.pow, std.math.hypot
Created using PHP docwiki written by Markus Dangl. Best viewed with Mozilla Firefox.