ieee(3M)
NAME
copysign(), copysignf(), drem(), finite(), finitef(), logb(), scalb() − exponent manipulations
SYNOPSIS
#include <math.h>
double copysign(double x, double y);
double drem(double x, double y);
int finite(double x);
double logb(double x);
double scalb(double x, int n);
float copysignf(float x, float y);
int finitef(float x);
DESCRIPTION
These functions are required for, or recommended by, the IEEE -754 standard for floating-point arithmetic.
copysign() returns x with its sign changed to y’s.
drem() returns the remainder r=x−n∗y where n is the integer nearest the exact value of x/y; moreover, if |n−x/y| = 1/2, then n is even. Consequently the remainder is computed exactly and |r| ≤ |y|/2. But drem(x,0) is exceptional; see below under ERRORS.
finite() returns 1 only when −INFINITY < x < +INFINITY. Otherwise it returns 0 (i.e., when |x| = INFINITY or x is NaN).
logb() returns x’s exponent n, a signed integer converted to double-precision floating point and chosen such that 1 ≤ |x|/2∗∗n < 2 unless x = 0 or (only on machines that conform to the IEEE -754 standard) |x| = INFINITY or x lies between 0 and the underflow threshold.
scalb() returns x∗(2∗∗n) computed, for integer n, without first computing 2∗∗n.
copysignf() and finitef() are float versions of copysign() and finite(). They are named in accordance with the conventions specified in the "Future Library Directions" section of the ANSI C standard. Programs must be compiled in ANSI mode (use the -Aa option) in order to use these functions; otherwise, the compiler promotes the float arguments to double, and the functions return incorrect results.
DEPENDENCIES
Series 300/400
These functions are not supported on Series 300/400 systems.
Series 700/800
These functions are provided in the PA1.1 versions of the math library only. The +DA1.1 option (the default on Series 700 systems) links in a PA1.1 version automatically. A PA1.1 library can be linked in explicitly. For more information, see the HP-UX Floating-Point Guide.
ERRORS
The IEEE -754 standard defines drem(x,0) and drem(INFINITY,y) to be invalid operations that produce a NaN.
The IEEE -754 standard defines logb(±INFINITY) = +INFINITY and logb(0) = −INFINITY, and requires the latter to signal a division-by-zero exception.
SEE ALSO
isnan(3M), isinf(3M), fpclassify(3M).
Hewlett-Packard Company — HP-UX Release 9.10: April 1995