[ Previous | Next | Table of Contents | Index | Library Home |
Legal |
Search ]
Technical Reference: Base Operating System and Extensions , Volume 2
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:
- If x is NaN,
then the rsqrt subroutine returns NaN. If x is a
signaling Nan (NaNS), then the rsqrt subroutine returns a quiet NaN
and sets the VX and VXSNAN (signaling NaN invalid
operation exception) flags in the FPSCR (Floating-Point Status and Control
register) to 1.
- If x is +/-
0.0, then the rsqrt subroutine returns +/- INF and sets the
ZX (zero divide exception) flag in the FPSCR to 1.
- If x is
negative, then the rsqrt subroutine returns NaN, sets the
errno global variable to EDOM, and sets the
VX and VXSQRT (square root of negative number invalid
operation exception) flags in the FPSCR to 1.
When using the
libmsaa.a library, the rsqrt subroutine responds
to special values of x in the following ways:
- If x is +/-
0.0, then the rsqrt subroutine returns +/-HUGE_VAL and sets
the errno global variable to EDOM. The subroutine
invokes the matherr subroutine, which prints a
message indicating a singularity error to standard error output.
- If x is
negative, then the rsqrt subroutine returns 0.0 and sets the
errno global variable to EDOM. The subroutine
invokes the matherr subroutine, which prints a message indicating a
domain error to standard error output.
When compiled with
libmsaa.a, a program can use the matherr
subroutine to change these error-handling procedures.
x
| Specifies a double-precision floating-point value.
|
Upon successful completion, the
rsqrt subroutine returns the reciprocal of the square root
of x.
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:
EDOM
| The value of x is negative.
|
This subroutine is part of Base
Operating System (BOS) Runtime.
The matherr subroutine, sqrt or
cbrt (sqrt, sqrtl, or cbrt Subroutine) subroutine.
[ Previous | Next | Table of Contents | Index |
Library Home |
Legal |
Search ]