frexp
for integers
intexp: Similarly to the libc frexp
function, this decomposes a given integer value x
into an integer coefficient c
and an integral power of two n
such that
c * 2n = x
ldexp
is also provided as an inverse function for convenience.
Methods
intexp(integer)
Returns [coefficient, exponent]
e.g.
const intexp = ; const decomposed = // [19, 8]
ldexp(coefficient, exponent)
Returns integer given coefficient and exponent. e.g.
const ldexp = ; const int = // 4864