[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2
rsqrt Subroutine
Purpose
Computes the reciprocal of the square root of a number.
Libraries
IEEE Math Library (libm.a)
System V Math Library (libmsaa.a)
Syntax
#include <math.h>
double rsqrt(double x)
Description
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.
Parameter
x |
Specifies a double-precision floating-point value. |
Return Values
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. |
Error Codes
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. |
Implementation Specifics
This subroutine is part of Base Operating System (BOS) Runtime.
Related Information
The matherr subroutine, sqrt or cbrt subroutine.
[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]