Function: frexp

frexp is a function defined in floatfns.c.

Signature

(frexp X)

Documentation

Get significand and exponent of a floating point number.

Breaks the floating point number X into its binary significand SGNFCAND
(a floating point value between 0.5 (included) and 1.0 (excluded))
and an integral exponent EXP for 2, such that:

  X = SGNFCAND * 2^EXP

The function returns the cons cell (SGNFCAND . EXP). If X is zero, both parts (SGNFCAND and EXP) are zero.

Other relevant functions are documented in the number group.

Probably introduced at or before Emacs version 24.1.

Shortdoc

;; number
(frexp 5.7)
    => (0.7125 . 3)

Source Code

// Defined in /usr/src/emacs/src/floatfns.c
{
  double f = extract_float (x);
  int exponent;
  double sgnfcand = frexp (f, &exponent);
  return Fcons (make_float (sgnfcand), make_fixnum (exponent));
}