frexp(p1)
public
Returns a two-element array containing the normalized fraction (a Float) and exponent (a Fixnum) of numeric.
fraction, exponent = Math.frexp(1234)
fraction * 2**exponent
Show source
/*
* call-seq:
* Math.frexp(numeric) => [ fraction, exponent ]
*
* Returns a two-element array containing the normalized fraction (a
* <code>Float</code>) and exponent (a <code>Fixnum</code>) of
* <i>numeric</i>.
*
* fraction, exponent = Math.frexp(1234)
* fraction * 2**exponent
*/
static VALUE
math_frexp(obj, x)
VALUE obj, x;
{
double d;
int exp;
Need_Float(x);
d = frexp(RFLOAT(x)->value, &exp);
return rb_assoc_new(rb_float_new(d), INT2NUM(exp));
}