Math.frexp

From GiderosMobile
Revision as of 09:05, 14 November 2022 by MoKaLux (talk | contribs)

Available since: Gideros 2011.6
Class: math

Description

Used to split a floating-point number (v) into a normalized fraction (a mantissa) and an integer exponent.

(number) (number) = math.frexp(v)

Returns m and e such that v = m*2^e, e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when v is zero).

Parameters

v: (number) value

Return values

Returns (number) the mantissa, a multiplier in the range [0.5, 1) (normalized fraction)
Returns (number) the exponent as an integer

Note

math.ldexp is the inverse operation.