frexp#

Split a floating-point number into mantissa and exponent.

Synopsis#

my ($frac, $exp) = POSIX::frexp($x);

## $x == $frac * 2**$exp, with 0.5 <= |$frac| < 1 (or $frac == 0).

What you get back#

A two-element list: the fractional part as a double and the exponent as an integer.

Differences from upstream#

Fully compatible with upstream POSIX.

See also#

  • ldexp — the inverse operation: reassemble $x from $frac and $exp.

  • modf — split into integer and fractional parts instead.