public Method

Float.ceil

flt.ceil     integer

Returns the smallest Integer greater than or equal to flt.

1.2.ceil      #=> 2
2.0.ceil      #=> 2
(-1.2).ceil   #=> -1
(-2.0).ceil   #=> -2

Source Code

/*
*  call-seq:
*     flt.ceil    => integer
*  
*  Returns the smallest <code>Integer</code> greater than or equal to
*  <i>flt</i>.
*     
*     1.2.ceil      #=> 2
*     2.0.ceil      #=> 2
*     (-1.2).ceil   #=> -1
*     (-2.0).ceil   #=> -2
*/

static VALUE
flo_ceil(num)
   VALUE num;
{
   double f = ceil(RFLOAT(num)->value);
   long val;

   if (!FIXABLE(f)) {
       return rb_dbl2big(f);
   }
   val = f;
   return LONG2FIX(val);
}
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.