frexp(3C) frexp(3C)
frexp, ldexp, logb, ilogb, modf, modff, nextafter, scalb, frexpl, ldexpl,
logbl, modfl, nextafterl, scalbl - manipulate parts of floating-point
numbers (libc routines)
#include <math.h>
double frexp (double value, int *eptr);
double ldexp (double value, int exp);
double logb (double value);
int ilogb (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);
long double frexpl (long double value, int *eptr);
long double ldexpl (long double value, int exp);
long double logbl (long double value);
long double nextafterl (long double value1, long double value2);
long double scalbl (long double value, long double exp);
long double modfl (long double value, long double *iptr);
(Note that the long double routines are only valid for the MIPSpro
compilers.) Long double functions have been renamed to be compliant with
the ANSI-C standard, however to be backward compatible, they may still be
called with the double precision function name prefixed with a q.
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, and stores the
exponent indirectly in the location pointed to by eptr. If value is
zero, both results returned by frexpl are zero.
Page 1
frexp(3C) frexp(3C)
ldexp and scalb return the quantity value*2**exp. The only difference
between the two is that scalb of a signaling NaN will result in the
invalid operation exception being raised. Users should note that routine
scalb in libm43 with prototype
double scalb (double value, int exp)
conflicts with the above definition of scalb. If it is necessary to call
the libc version of scalb in this situation, the strong name _scalb
should be used.
ldexpl and scalbl return the quantity value*2**exp. The only difference
between the two is that scalbl of a signaling NaN will result in the
invalid operation exception being raised.
logb returns the unbiased exponent of its floating-point argument as a
double-precision floating-point value.
ilogb returns the unbiased exponent of its floating-point argument as an
integer value. The call ilogb(x) is equivalent to (int)logb(x).
logbl returns the unbiased exponent of its floating-point argument as a
long double-precision floating-point value.
modf , modff (single-precision version) and modfl (long double-precision
version) 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 double-precision floating-point
value following value1 in the direction of value2. Thus, if value2 is
less than value1, nextafter returns the largest representable floatingpoint
number less than value1.
nextafterl returns the next representable long double-precision
floating-point value following value1 in the direction of value2.
cc(1), intro(3M).
If ldexp or ldexpl would cause overflow, +_HUGE_VAL (defined in math.h) is
returned (according to the sign of value), and errno is set to ERANGE.
If ldexp or ldexpl would cause underflow, zero is returned and errno is
set to ERANGE. If the input value to ldexp or ldexpl is NaN, the default
quiet NaN is returned and errno is set to EDOM. If the input value to
ldexp or ldexpl is Infinity, Infinity is returned and errno is set to
ERANGE. The same error conditions apply to scalb and scalbl except that
a signaling NaN as input will result in the raising of the invalid
operation exception.
Page 2
frexp(3C) frexp(3C)
logb and logbl of NaN returns that NaN, logb and logbl of infinity return
positive infinity, and logb and logbl of zero return negative infinity
and result in the raising of the divide by zero exception. In each of
these conditions errno is set to EDOM.
ilogb of NaN or zero returns INT_MIN, ilogb of +infinity or -infinity
returns INT_MAX. In each of these conditions errno is not set.
If input value1 to nextafter or nextafterl is positive or negative
infinity, that input is returned and errno is set to EDOM. The overflow
and inexact exceptions are signalled when input value1 is finite, but
nextafter(value1<b>, value2<b>) or nextafterl(value1<b>, value2<b>) is not. The
underflow and inexact exceptions are signalled when nextafter(value1<b>,
value2<b>) lies strictly between _2**-1022 or nextafterl(value1<b>, value2<b>)
lies strictly between _2**-916. In these cases errno is also set to
ERANGE.
PPPPaaaaggggeeee 3333 [ Back ]
|