frexp(3C) frexp(3C)
NAME
frexp, frexpl, ldexp, ldexpl, logb, modf, modff, modfl,
nextafter, nextafterl, scalb, scalbl - manipulate parts of
floating-point numbers
SYNOPSIS
#include <math.h>
double frexp(double value, int *eptr);
long double frexpl(long double value, int *eptr);
double ldexp(double value, int exp);
long double ldexpl(long double value, int exp);
double logb(double value);
long double logbl(long double value);
double nextafter(double value1, double value2);
long double nextafterl(long double value1, long double value2);
double scalb(double value, double exp);
long double scalbl(long double value, double exp);
double modf(double value, double *iptr);
float modff(float value, float *iptr);
long double modfl(long double value, long double *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. frexpl returns
the mantissa of a long double value.
ldexp, ldexpl, scalb, and scalbl return the quantity value * 2
exp.
logb (logbl) returns the unbiased exponent of its floating-
point argument as a double-precision (extended double-
precision) floating-point value.
modf, modff, and modfl return the signed fractional part of
value and store the integral part indirectly in the location
pointed to by iptr.
nextafter and nextafterl return the next representable
floating-point value following value1 in the direction of
value2. Thus, if value2 is less than value1, nextafter and
nextafterl return the largest representable floating-point
number less than value1.
Copyright 1994 Novell, Inc. Page 1
frexp(3C) frexp(3C)
Errors
If the correct value of ldexp, ldexpl, scalb or scalbl 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 or logbl 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 or
logbl 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 or nextafterl 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, ldexpl, scalb and scalbl
will compare equal to HUGE instead of HUGE_VAL.
REFERENCES
cc(1), intro(3)
Copyright 1994 Novell, Inc. Page 2