FREXP(3) — C LIBRARY FUNCTIONS
NAME
frexp, ldexp, modf − floating point analysis and synthesis
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
Frexp returns the significand of a double value as a double quantity, x, of magnitude less than 1 and stores an integer n, indirectly through eptr, such that value = x∗2n.
The results are not defined when value is an IEEE infinity or NaN.
ldexp returns the quantity:
value∗2exp.
modf returns the fractional part of value and stores the integral part indirectly through iptr. Thus the argument value and the returned values modf and ∗iptr satisfy, in the absence of rounding error,
(∗iptr + modf) == value
and
0 <= abs(modf) < abs(value).
The signs of ∗iptr and modf are the same as the signs of value. The results are not defined when value is an IEEE infinity or NaN.
Since Sun’s definition of modf conforms to the System V Interface Definition and the VAX 4.2BSD implementation but differs from the 4.2BSD documentation, results vary from some other Unix implementations whose modf conforms to the 4.2BSD documentation but not the VAX 4.2BSD implementation. Therefore avoid modf in code intended to be portable.
SEE ALSO
Sun Release 3.4 — Last change: 16 September 1986