# finite(3) [osf1 man page]

```ieee_functions(3)					     Library Functions Manual						 ieee_functions(3)

NAME
copysign, finite, fp_class, isnan, nextafter, unordered	- Related miscellaneous IEEE arithmetic functions.

LIBRARY
Math Library (libm.a)

SYNOPSIS
#include <math.h>

double copysign	 (double x, double y); float  copysignf  (float  x, float  y); long double copysignl   (long double x, long double y); int
finite	  (double x); int    finitef	(float	x); int    finitel     (long double x); int    fp_class    (double  x);  int	 fp_classf
(float  x); int	  fp_classl   (long double x); int    isnan	 (double x); int    isnanf     (float  x); int	  isnanl      (long double
x); double nextafter  (double x, double y); float  nextafterf (float  x, float  y); long double nextafterl  (long double x, long double y);
int    unordered  (double x, double y); int    unorderedf (float  x, float  y); int    unorderedl  (long double x, long double y);

STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:

isnan():  XPG4

nextafter():  XPG4-UNIX

DESCRIPTION
The  copysign(),  copysignf(),  and  copysignl()  functions  return  x  with  the same sign as y.  IEEE 754 requires copysign(x,NaN), copy-
signf(x,NaN) and copysignl(x,NaN) to return +x or -x.

The finite(), finitef(), and finitel() functions return the integer value 1 (True) or 0 (False).  The finite(x), finitef(x),
and finitel(x) functions return 1 when -infinity < x < +infinity.  They return 0 when |x| = infinity or x is a NaN.

The fp_class(), fp_classf(),  and fp_classl() functions determine the class of an IEEE floating-point value.  They return one of  the  con-
stants  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 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)
-----------------------------------------------------

The  isnan(), isnanf(), and isnanl() functions return the value 1 (True) if x is NaN (the IEEE floating point reserved not-a-number value);
otherwise, it returns the value 0 (False).

The nextafter(), nextafterf(), and nextafterl() functions return the next machine-representable number from x in the direction of y.

The unordered(), unorderedf(), and unorderedl() functions return the value 1 (True) if either x or y  or  both  is  a  NaN;  otherwise,	it
returns the value 0 (False).

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 delim off

ieee_functions(3)```

## Check Out this Related Man Page

```ieee(3m)																  ieee(3m)

Name
copysign, drem, finite, logb, scalb - copysign, remainder, exponent manipulations

Syntax
#include <math.h>

double copysign(x,y)
double x,y;

double drem(x,y)
double x,y;

int finite(x)
double x;

double logb(x)
double x;

double scalb(x,n)
double x;
int n;

Description
These functions are required, or recommended by the IEEE standard 754 for floating-point arithmetic.

The function returns x with its sign changed to y's.

The function returns the remainder r := x - n*y where n is the integer nearest the exact value of x/y.  Additionally if |n-x/y|=1/2, then n
is even.  Consequently the remainder is computed exactly and |r| <= |y|/2.  Note that is the exception (see Diagnostics).

Finite(x) = 1 just when -infinity < x < +infinity,
= 0 otherwise (when |x| = infinity or x is NaN)

The a signed integer converted to double-precision floating-point and so chosen that 1 <= |x|/2**n < 2 unless x = 0 or |x| = infinity or  x
lies between 0 and the Underflow Threshold.

Scalb(x,n) = x*(2**n) computed, for integer n, without first computing 2**N.

Diagnostics
IEEE 754 defines drem(x,0) and drem(infinity,y) to be invalid operations that produce a NaN.

IEEE 754 defines logb(+-infinity) = +infinity and logb(0) = -infinity, requires the latter to signal Division-by-Zero.

Restrictions
IEEE 754 currently specifies that logb(denormalized no.) = logb(tiniest normalized no. > 0) but the consensus has changed to the specifica-
tion in the new proposed IEEE standard p854, namely that logb(x) satisfy
1 <= scalb(|x|,-logb(x)) < Radix	 ... = 2 for IEEE 754
for every x except 0, infinity and NaN.	Almost every program that assumes 754's specification will work correctly if  logb  follows  854's