frexp(3C)frexp(3C)NAME
frexp, ldexp, scalb, frexpf, ldexpf, frexpl, ldexpl, scalbl - manipulate
parts of floating-point numbers (libc routines)
SYNOPSIS
#include <math.h>
double frexp (double value, int *eptr);
double ldexp (double value, int exp);
double scalb (double value, double exp);
float frexpf (float value, int *eptr);
float ldexpf (float value, int exp);
long double frexpl (long double value, int *eptr);
long double ldexpl (long double value, int exp);
long double scalbl (long double value, long double exp);
DESCRIPTION
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 (qfrexp for
example).
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.
frexpf and frexpl are the float and long double analogues of frexp.
ldexp and scalb return the quantity value*2**exp. Besides the type of
the second parameter, 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.
Page 1
frexp(3C)frexp(3C)
ldexpf and ldexpl are the float and long double analogues of ldexp.
NOTES
The functions scalb and scalbl are supplied for backward compatability
and are not specified by the ANSI C Programming Language Specification
ISO/IEC 9899 : 1999 (E). (Scalbf is not supplied.)
Long double operations on this system are only supported in round to
nearest rounding mode (the default). The system must be in round to
nearest rounding mode when calling any of the long double functions, or
incorrect answers will result.
Users concerned with portability to other computer systems should note
that the long double and float versions of these functions were optional
according to the ANSI C Programming Language Specification ISO/IEC 9899 :
1990 (E) and are no longer optional according to ISO/IEC 9899:1999(E).
SEE ALSOcc(1), intro(3M).
DIAGNOSTICS
If ldexp would cause overflow, _HUGE_VAL (defined in math.h) is returned
(according to the sign of value), and errno is set to ERANGE. Similarly
for ldexpf and ldexpl, which return _HUGE_VALF and _HUGE_VALL,
respectively.
If ldexp would cause underflow, zero is returned and errno is set to
ERANGE. Similarly for ldexpf and ldexpl, which return 0.0f and 0.0L,
resp. If the input value to ldexp is NaN, the default quiet NaN is
returned and errno is set to EDOM. Similarly for ldexpf and ldexpl. If
the input value to ldexp is Infinity, Infinity is returned and errno is
set to ERANGE. Similarly for ldexpf and ldexpl. 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