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:
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
|