Synopsis
#include <math.h>
double sqrt(double val);
Description

sqrt computes the nonnegative square root of val. C90 and C99 require that a domain error occurs if the argument is less than zero. CrossWorks C deviates and always uses IEC 60559 semantics.

Special cases

If val is +0, sqrt returns +0.
If val is -0, sqrt returns -0.
If val is ∞, sqrt returns ∞.
If val < 0, sqrt returns NaN with invalid signal.
If val is NaN, sqrt returns that NaN with invalid signal for signaling NaN.

Portability

sqrt conforms to ISO/IEC 9899:1990 (C90) and ISO/IEC 9899:1999 (C99) except in the case of domain errors.