Computes the square root.
#include <math.h>
double sqrt ( x)
double x;
float sqrtf (x) float x;
long double sqrtl (x) long double x;
The sqrt, sqrtf, and sqrtl subroutines compute the square root of the x parameter.
An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
x | Specifies some double-precision floating-point value. |
Upon successful completion, the sqrtf subroutine returns the square root of x.
For finite values of x < -0, a domain error occurs, and a NaN is returned.
If x is NaN, a NaN is returned.
If x is ±0 or +Inf, x is returned.
If x is -Inf, a domain error shall occur, and a NaN is returned.
When using libm.a (-lm):
For the sqrt subroutine, if the value of x is negative, a NaNQ is returned and the errno global variable is set to a EDOM value.
When using libmsaa.a (-lmsaa):
If the value of x is negative, a 0 is returned and the errno global variable is set to a EDOM value. A message indicating a DOMAIN error is printed on the standard error output.
These error-handling procedures may be changed with the matherr subroutine when using the libmsaa.a (-lmsaa) library.
The exp, expm1, log, log10, log1p, or pow subroutine.
feclearexcept Subroutine, fetestexcept Subroutine, and class, _class, finite, isnan, or unordered Subroutines in AIX 5L Version 5.2 Technical Reference: Base Operating System and Extensions Volume 1.
math.h in AIX 5L Version 5.2 Files Reference.
Subroutines Overview AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
128-Bit long double Floating-Point Format AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.