Document revision date: 19 July 1999 | |
Previous | Contents | Index |
F_TYPE drem (F_TYPE x, F_TYPE y)
drem() returns the remainder r = x-n*y, where n = rint(x/y). Additionally, if |n-x/y|=1/2, then n is even. The remainder is computed exactly, and |r| is less than or equal to |y|/2. The drem() and remainder() functions are aliases of each other.IEEE Std 754 defines drem(x,0) and drem(infinity,y) to be invalid operations that produce a NaN.
Exceptional Argument | Routine Behavior |
---|---|
y = 0 | Invalid argument |
x = infinity | Invalid argument |
F_TYPE erf (F_TYPE x)
F_TYPE erfc (F_TYPE x)
erf() returns the value of the error function where erf(x) equals (2 * sqrt(pi)) times the area under the curve e**(-t**2) between 0 and x.erfc() returns (1.0-erf(x)). The erfc() function can result in an underflow as x gets large.
F_TYPE exp (F_TYPE x)
F_TYPE expm1 (F_TYPE x)
exp() computes the value of the exponential function, defined as e**x, where e is the constant used as a base for natural logarithms.expm1() computes exp(x)-1 accurately, even for tiny x.
Exceptional Argument | Routine Behavior |
---|---|
x > ln(max_float) | Overflow |
x < ln(min_float) | Underflow |
F_TYPE fabs (F_TYPE x)
fabs() computes the absolute value of x.
int finite (F_TYPE x)
finite() returns the integer value 1 (true) or 0 (false).finite(x) = 1 when -infinity < x < +infinity.
finite(x) = 0 when |x| = infinity or x is a NaN.
F_TYPE floor (F_TYPE x)
floor() returns the largest floating-point integer value less than or equal to x.
F_TYPE fmod (F_TYPE x, F_TYPE y)
fmod() computes the floating-point remainder of x modulo y. It returns the remainder r = x-n*y, where n = trunc(x/y). The remainder is computed exactly.The result has the same sign as x and a magnitude less than the magnitude of y.
Exceptional Argument | Routine Behavior |
---|---|
x = infinity | Invalid argument |
y = 0 | Invalid argument |
int fp_class (F_TYPE x)
These routines determine the class of IEEE floating-point values. They return one of the constants in the file <fp_class.h> and never cause an exception, even for signaling NaNs. These routines implement the recommended function class(x) in the appendix of the IEEE Std 754. The constants in <fp_class.h> refer to the following classes of values:
Constant Class FP_SNAN Signaling NaN (Not-a-Number) FP_QNAN Quiet NaN (Not-a-Number) FP_POS_INF +Infinity FP_NEG_INF -Infinity FP_POS_NORM Positive normalized FP_NEG_NORM Negative normalized FP_POS_DENORM Positive denormalized FP_NEG_DENORM Negative denormalized FP_POS_ZERO +0.0 (positive zero) FP_NEG_ZERO -0.0 (negative zero)
F_TYPE frexp (F_TYPE x, int *n)
frexp() breaks a floating-point number into a normalized fraction and an integral power of 2. It stores the integer in the int object pointed to by the n parameter and returns the fraction part.
Exceptional Argument | Routine Behavior |
---|---|
|x| = infinity | Invalid argument |
F_TYPE hypot (F_TYPE x, F_TYPE y)
hypot() computes the length of the hypotenuse of a right triangle, where x and y represent the perpendicular sides of the triangle.hypot(x,y) is defined as the square root of (x**2 + y**2) and returns the same value as cabs(x,y).
Exceptional Argument | Routine Behavior |
---|---|
sqrt(x**2 + y**2) > max_float | Overflow |
int ilogb (F_TYPE x)
ilogb() returns the integral part of log_r(|x|) as a signed integral value, for x is not equal to 0, where r is the radix of the machine's floating point arithmetic.
Exceptional Argument | Routine Behavior |
---|---|
|x| = infinity | INT_MAX |
x = 0, NaN | INT_MIN |
int isnan (F_TYPE x)
isnan() returns 1 (true) if x is NaN (the IEEE floating-point reserved Not-a-Number value) and 0 (false) otherwise.
F_TYPE ldexp (F_TYPE x, int n)
ldexp() multiplies a floating-point number, x, by 2**n.
Exceptional Argument | Routine Behavior |
---|---|
|x*(2**n)| > max_float | Overflow |
|x*(2**n)| < min_float | Underflow |
F_TYPE lgamma (F_TYPE x)
lgamma() returns the logarithm of the absolute value of gamma of x, or ln(|G(x)|), where G is the gamma function. The sign of gamma of x is returned in the external integer variable signgam as +1 or -1. The x parameter cannot be 0 or a negative integer.gamma() returns the natural log of the gamma function and so is functionally equivalent to lgamma(). Because of this, gamma() is marked TO BE WITHDRAWN in the X/Open Portability Guide, Revision 4 (XPG4).
Exceptional Argument | Routine Behavior |
---|---|
|x| = infinity | Invalid argument |
x = 0, -1, -2, -3, ... | Invalid argument |
|x| > lgamma_max_float | Overflow |
F_TYPE ln (F_TYPE x)
F_TYPE log2 (F_TYPE x)
F_TYPE log10 (F_TYPE x)
F_TYPE log1p (F_TYPE y)
ln() computes the natural (base e) logarithm of x.log2() computes the base 2 logarithm of x.
log10() computes the common (base 10) logarithm of x.
log1p() computes ln(1+y) accurately, even for tiny y.
Exceptional Argument | Routine Behavior |
---|---|
x < 0 | Invalid argument |
x = 0 | Overflow |
1+y < 0 | Invalid argument |
1+y = 0 | Overflow |
F_TYPE logb (F_TYPE x)
logb() returns a signed integer converted to double-precision floating-point and so chosen that 1 <= |x|/2**n < 2 unless x = 0 or |x| = infinity.IEEE Std 754 defines logb(+infinity) = +infinity and logb(0) = -infinity. The latter is required to signal division by zero.
Exceptional Argument | Routine Behavior |
---|---|
|x| = infinity | Invalid argument |
F_TYPE modf (F_TYPE x, F_TYPE *n)
modf() splits a floating-point number x into a fractional part f and an integer part i such that |f| < 1.0 and (f + i) = x. Both f and i have the same sign as x. modf() returns f and stores i into the location pointed to by n.
F_TYPE nextafter (F_TYPE x, F_TYPE y)
nextafter() returns the machine-representable number next to x in the direction y.
Exceptional Argument | Routine Behavior |
---|---|
x = max_float and y = +infinity | Overflow |
x = -max_float and y = -infinity | Overflow |
x = min_float and y is less than or equal to 0 | Underflow |
x = -min_float and y is greater than or equal to 0 | Underflow |
F_TYPE nint (F_TYPE x)
nint() returns the nearest integral value to x, except halfway cases are rounded to the integral value larger in magnitude. This function corresponds to the Fortran generic intrinsic function nint().
F_TYPE pow (F_TYPE x, F_TYPE y)
pow() raises a floating-point base x to a floating-point exponent y. The value of pow(x,y) is computed as e**(y ln(x)) for positive x. If x is 0 or negative, see your language reference manual.Passing a NaN input value to pow() produces a NaN result for nonzero values of y. For pow(NaN,0), see your language reference manual.
Exceptional Argument | Routine Behavior |
---|---|
y ln(x) > ln(max_float) | Overflow |
y ln(x) < ln(min_float) | Underflow |
Fortran-Exceptional Argument | Routine Behavior |
x < 0 | Invalid argument |
x = 0 and y < 0 | Invalid argument |
x = 0 and y = 0 | Invalid argument |
x = +infinity and y = 0 | Invalid argument |
x = 1 and |y| = infinity | Invalid argument |
ANSI C-Exceptional Argument | Routine Behavior |
|x| = 1 and |y| = infinity | Invalid argument |
x < 0 and y is not integral | Invalid argument |
F_TYPE random (int *n)
random() is a general random number generator. The argument to the random function is an integer passed by reference. There are no restrictions on the input argument, although it should be initialized to different values on separate runs in order to obtain different random sequences. This function must be called again to obtain the next pseudorandom number. The argument is updated automatically.The result is a floating-point number that is uniformly distributed in the interval (0.0,1.0).
F_TYPE remainder (F_TYPE x, F_TYPE y)
remainder() returns the remainder r = x-n*y, where n = rint(x/y). Additionally, if |n-x/y|=1/2, then n is even. Consequently, the remainder is computed exactly, and |r| is less than or equal to |y|/2. The drem() and remainder() functions are aliases of each other.IEEE Std 754 defines remainder(x,0) and remainder(infinity,y) to be invalid operations that produce a NaN.
Exceptional Argument | Routine Behavior |
---|---|
y = 0 | Invalid argument |
x = infinity | Invalid argument |
F_TYPE rint (F_TYPE x)
rint() rounds x to an integral value according to the current IEEE rounding direction specified by the user.
F_TYPE scalb (F_TYPE x, F_TYPE y)
scalb() = x*(2**y) computed, for integer y.
Exceptional Argument | Routine Behavior |
---|---|
x*(2**y) > max_float | Overflow |
x*(2**y) < min_float | Underflow |
F_TYPE sin (F_TYPE x)
F_TYPE sind (F_TYPE x)
sin() computes the sine of x, measured in radians.sind() computes the sine of x, measured in degrees.
Exceptional Argument | Routine Behavior |
---|---|
|x| = infinity | Invalid argument |
(sind) |x| < (180/pi) * min_float | Underflow |
F_COMPLEX sincos (F_TYPE x)
F_COMPLEX sincosd (F_TYPE x)
sincos() computes both the sine and cosine of x, measured in radians.sincosd() computes both the sine and cosine of x, measured in degrees.
sincos(x) is defined as (sin x + icos y).
Exceptional Argument | Routine Behavior |
---|---|
|x| = infinity | Invalid argument |
(sind) |x| < (180/pi) * min_float | Underflow |
F_TYPE sinh (F_TYPE x)
sinh() computes the hyperbolic sine of x.sinh(x) is defined as (exp(x)-exp(-x))/2.
Exceptional Argument | Routine Behavior |
---|---|
|x| > ln(2 * max_float) | Overflow |
Previous | Next | Contents | Index |
privacy and legal statement | ||
6118PRO_003.HTML |