Computes the reciprocal of the square root of a number.
IEEE Math Library (libm.a)
System V Math Library (libmsaa.a)
#include <math.h>
double rsqrt(double x)
The rsqrt command computes the reciprocal of the square root of a number x; that is, 1.0 divided by the square root of x (1.0/sqrt(x)). On some platforms, using the rsqrt subroutine is faster than computing 1.0 / sqrt(x). The rsqrt subroutine uses the same rounding mode used by the calling program.
When using the libm.a library, the rsqrt subroutine responds to special values of x in the following ways:
When using the libmsaa.a library, the rsqrt subroutine responds to special values of x in the following ways:
When compiled with libmsaa.a, a program can use the matherr subroutine to change these error-handling procedures.
Item | Description |
---|---|
x | Specifies a double-precision floating-point value. |
Upon successful completion, the rsqrt subroutine returns the reciprocal of the square root of x.
Item | Description |
---|---|
1.0 | If x is 1.0. |
+0.0 | If x is +INF. |
When using either the libm.a or libmsaa.a library, the rsqrt subroutine may return the following error code:
Item | Description |
---|---|
EDOM | The value of x is negative. |