ieee_functions(3M)
NAME
ieee_functions, ilogb, isnan, copysign, fabs, fmod, nextafter, remainder, scalbn − appendix and related miscellaneous functions for IEEE arithmetic
SYNOPSIS
cc [ flag ... ] file ... −lm [ library ... ]
#include <math.h>
int ilogb(double x);
int isnan(double x);
double copysign(double x, double y);
double fabs(double x);
double fmod(double x, double y);
double nextafter(double x, double y);
double remainder(double x, double y);
double scalbn(double x, int n);
MT-LEVEL
MT-Safe
DESCRIPTION
Most of these functions provide capabilities required by ANSI/IEEE Std 754-1985 or suggested in its appendix.
ilogb(x) returns the unbiased exponent of x in integer format. ilogb(±∞) = +MAXINT and ilogb(0) = −MAXINT; <values.h> defines MAXINT as the largest int. ilogb(x) never generates an exception. When x is subnormal, ilogb(x) returns an exponent computed as if x were first normalized.
isnan(x) returns 1 if x is NaN; otherwise it returns 0.
copysign(x,y) returns a value with the magnitude of x and with the sign bit of y.
fabs(x) returns the absolute value of x.
nextafter(x,y) returns the next machine representable number from x in the direction y.
remainder(x,y) and fmod(x,y) return a remainder of x with respect to y; that is, the result r is one of the numbers that differ from x by an integral multiple of y. Thus (x−r)/y is an integral value, even though it might exceed MAXINT, the largest int defined in <values.h> if it were explicitly computed as an int. Both functions return one of the two such r smallest in magnitude. remainder(x,y) is the operation specified in ANSI/IEEE Std 754-1985; the result of fmod(x,y) may differ from remainder’s result by ±y. The magnitude of remainder’s result cannot exceed half that of y; its sign might not agree with either x or y. The magnitude of fmod’s result is less than that of y; its sign agrees with that of x. Neither function can generate an exception as long as both arguments are normal or subnormal.
remainder(x,0), fmod(x,0), remainder(∞,y), and fmod(∞,y) are invalid operations; in IEEE754 mode (i.e. the −xlibmieee cc compilation option), a NaN is returned.
scalbn(x,n) returns x∗2∗∗n computed by exponent manipulation rather than by actually performing an exponentiation or a multiplication. Thus
1 ≤ scalbn(fabs(x),−ilogb(x)) < 2
for every x except 0, ∞, and NaN.
RETURN VALUES
For exceptional cases, matherr(3M) tabulates the values to be returned as dictated by various Standards.
SEE ALSO
SunOS 5.5.1 — Last change: 4 Mar 1994