static public Method

Math.ldexp(p1, p2)

Math.ldexp(flt, int)  float

Returns the value of flt*(2**int).

fraction, exponent = Math.frexp(1234)
Math.ldexp(fraction, exponent)   #=> 1234.0

Source Code

/*
*  call-seq:
*     Math.ldexp(flt, int) -> float
*  
*  Returns the value of <i>flt</i>*(2**<i>int</i>).
*     
*     fraction, exponent = Math.frexp(1234)
*     Math.ldexp(fraction, exponent)   #=> 1234.0
*/

static VALUE
math_ldexp(obj, x, n)
   VALUE obj, x, n;
{
   Need_Float(x);
   return rb_float_new(ldexp(RFLOAT(x)->value, NUM2INT(n)));
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.