Skip to content
class method

Math.frexp

(::Math::double x) -> [ ::Float, ::Integer ]
Math.frexp(x) → [fraction, exponent]

Returns a 2-element array containing the normalized signed float fraction and integer exponent of x such that:

Example
x = fraction * 2**exponent

See IEEE 754 double-precision binary floating-point format: binary64.

  • Domain: [-INFINITY, INFINITY].

  • Range [-INFINITY, INFINITY].

Examples:

Example
frexp(-INFINITY) # => [-Infinity, -1]
frexp(-2.0)      # => [-0.5, 2]
frexp(-1.0)      # => [-0.5, 1]
frexp(0.0)       # => [0.0, 0]
frexp(1.0)       # => [0.5, 1]
frexp(2.0)       # => [0.5, 2]
frexp(INFINITY)  # => [Infinity, -1]

Related: Math.ldexp (inverse of Math.frexp).

See also .expm1 .gamma .exp .hypot also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0