frexp(3C) DG/UX R4.11MU05 frexp(3C)
NAME
frexp, ldexp, logb, modf, modff, nextafter, scalb - manipulate parts
of floating-point numbers
SYNOPSIS
#include <math.h>
double frexp(double value, int *eptr);
double ldexp(double value, int exp);
double logb(double value);
double nextafter(double value1, double value2);
double scalb(double value, double exp);
double modf(double value, double *iptr);
float modff(float value, float *iptr);
DESCRIPTION
Every non-zero number can be written uniquely as x * 2 n, where the
``mantissa'' (fraction) x is in the range 0.5 <= | x | < 1.0, and the
``exponent'' n is an integer. frexp returns the mantissa of a double
value and stores the exponent indirectly in the location pointed to
by eptr. If value is zero, both results returned by frexp are zero.
ldexp and scalb return the quantity value * 2 exp.
logb returns the unbiased exponent of its floating-point argument as
a double-precision floating-point value.
modf and modff return the signed fractional part of value and store
the integral part indirectly in the location pointed to by iptr.
nextafter returns the next representable floating-point value
following value1 in the direction of value2. Thus, if value2 is less
than value1, nextafter returns the largest representable floating-
point number less than value1.
Errors
If the correct value of ldexp or scalb would cause overflow, these
functions return a value that will compare equal to ±HUGE_VAL
(according to the sign of value) and set errno to ERANGE. If the
correct value of these functions would cause underflow, zero is
returned and errno is set to ERANGE.
logb of zero returns -HUGE_VAL; on systems that support IEEE
floating-point, the divide by zero exception is raised. On systems
that support IEEE floating-point, logb of ± oo returns + oo. For
both of these error cases, errno is set to EDOM.
On systems that support IEEE floating-point, if input value1 to
nextafter is ± oo, that input is returned and errno is set to EDOM.
The overflow and inexact exceptions are signaled when input value1 is
finite, but
nextafter(value1, value2)
is not. The underflow and inexact exceptions are signaled when the
returned value is denormalized. In both cases errno is set to
ERANGE. (These last two conditions apply to nextafterl, as well.)
On systems that support IEEE NaN, if the input to any of these
functions is a quiet NaN, that NaN is returned. If the input is a
signaling NaN, a quiet NaN is returned and the invalid operation
exception is raised. In either case, errno is set to EDOM.
When the program is compiled with the cc option -Xt [see cc(1)], the
returned value of ldexp or scalb will compare equal to HUGE instead
of HUGE_VAL.
REFERENCES
cc(1), intro(3)
Licensed material--property of copyright holder(s)