FREXP(3C) SysV FREXP(3C)
NAME
frexp, ldexp, modf - manipulate parts of floating-point numbers
SYNOPSIS
double frexp (value, eptr)
double value;
int *eptr;
double ldexp (value, exp)
double value;
int exp;
double modf (value, iptr)
double value, *iptr;
DESCRIPTION
Every nonzero number can be written uniquely as x* 2n, 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 in the location pointed to by eptr. If
value is zero, both results returned by frexp are zero. ldexp returns the
quantity value* 2exp.
modf returns the signed fractional part of value and stores the integral
part in iptr.
DIAGNOSTICS
Upon successful completion, the frexp function returns the value x such
that x is a double with magnitude in the interval 1/2 to 1, or 0 (zero),
and value equals x times 2 raised to the power of *eptr. If value is 0,
both parts of the result are 0. If value is NaN, NaN is returned.
Otherwise, NaN is returned.
Upon successful completion, the ldexp function returns a double equal to
value times 2 to the power exp. If value is NaN, NaN is returned.
If ldexp would cause overflow, +HUGE_VAL is returned (according to the
sign of value) and errno is set to [ERANGE]. If ldexp would cause
underflow, 0 (zero) is returned and errno is set to [ERANGE]. Otherwise,
NaN is returned.
Upon successful completion, the modf function returns the signed
fractional part of value and stores the signed integral part in the
object pointed to by iptr. If value is NaN, then NaN is returned.
ERRORS
The ldexp function fails if
[ERANGE] The value to be returned would cause overflow or underflow.
SEE ALSO
isnan(3C),