ieee_functions(3) — Subroutines
NAME
copysign, isnan, finite, fp_class, nextafter, unordered − appendix and related miscellaneous functions for IEEE arithmetic
LIBRARY
Math Library (libm.a)
SYNOPSIS
#include <math.h>
double copysign (double x, double y);
float copysignf (float x, float y);
int finite (double x);
int finitef (float x);
int fp_class (double x);
int fp_classf (float x);
int isnan (double x);
int isnanf (float x);
double nextafter (double x, double y);
float nextafterf (float x, float y);
int unordered (double x, double y);
int unorderedf (float x, float y);
DESCRIPTION
copysign() and copysignf() return x with the same sign as y. IEEE 754 requires copysign(x,NaN) and copysignf(x,NaN) = +x or -x.
finite() and finitef() return the integer value 1 (True) or 0 (False). finite(x) and finitef(x) = 1 when -infinity < x < +infinity. finite(x) and finitef(x) = 0 when |x| = infinity or x is a NaN.
fp_class() and fp_classf() 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 are to implement the recommended function class(x) in the appendix of the IEEE 754-1985 standard for binary floating-point arithmetic. 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) |
isnan() and isnanf() return 1 (True) if x is NaN (the IEEE floating point reserved not-a-number value) and 0 (False) otherwise.
nextafter() and nextafterf() return the next machine representable number from x in the direction of y.
unordered() and unorderedf() return the value 1 (True) if either x or y or both is a NaN, and returns the value 0 (False) otherwise.
RELATED INFORMATION
drem(3), logb(3), scalb(3), rint(3), sqrt(3), and ANSI/IEEE Std 754-1985, IEEE Standard for Binary Floating-Point Arithmetic