ieee()

NAME

copysign(), drem(), copysignf(), finite(), finitef(), ilogb(), nextafter(), remainder(), scalbn() scalbnf() - functions for IEEE arithmetic

SYNOPSIS

#include <math.h>

double copysign (double x, double y) double drem (dobule x, double y) float copysignf (float x, float y) int finite (double x) int finitef (float x) int ilogb (double x) double nextafter (double x, double y) double remainder (double x, double y) double scalbn (double x, int n) float scalbnf (float x, int n)

DESCRIPTION

copysign(3) and copysignf(3) return x with its sign changed to y's.

The drem(3) function 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| lt;= |y|/2. But drem(x,0) is exceptional; see RETURN VALUE below.

finite(3) and finitef(3) return the value 1 just when -Infinity < x < +Infinity; otherwise a zero is returned (when |x| = Infinity or x is NaN.

ilogb(3) returns x's exponent n, in integer format. ilogb(+-f) returns INT_MAX and ilogb(0) returns -INT_MIN.

nextafter(3) returns the next machine representable number from x in direction y. The nextafter(3) function sets errno on error, so to check for errors, set errno to 0 before calling nextafter(3) and check its value after the call.

remainder(3) 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 remainder(x,0) and remainder(Infinity,0) are invalid operations that produce a NaN.

scalbn(3) and scalbnf(3) return x*(2**n) computed by exponent manipulation.

RETURN VALUE

The copysign(3) and copysignf(3) function return the value of x with the same sign as y.

drem(x,0) and drem(Infinity,y) are invalid operations that produce a NaN.

The finite(3) and finitef(3) functions return 1 if the argument x is neither +-Infinity. Otherwise it returns 0.

The ilogb(3) function returns x's exponent n, in integer format.

The nextafter(3) function returns the next representable double-precision floating point number after x in the direction of y.

The scalbn(3) and scalbnf(3) functions return the value of x*(2**n) without calculating 2**n first.

ERRORS

The nextafter(3) function can fail for the following reasons:

[EDOM]
One of the arguments is NaN.
[ERANGE]
The correct value would overflow.

The remainder(3) function can fail for the following reasons:

[EDOM]
The x argument is 0 or the y argument is +-Infinity, or either x or y is NaN.

SEE ALSO

math(3)