ceil(*args)
public
Returns the smallest number than or equal to int in decimal digits (default 0 digits).
Precision may be negative. Returns a
floating point number when ndigits is positive, self for
zero, and ceil up for negative.
1.ceil
1.ceil(2)
15.ceil(-1)
Show source
static VALUE
int_ceil(int argc, VALUE* argv, VALUE num)
{
int ndigits;
if (!rb_check_arity(argc, 0, 1)) return num;
ndigits = NUM2INT(argv[0]);
if (ndigits > 0) {
return rb_Float(num);
}
if (ndigits == 0) {
return num;
}
return rb_int_ceil(num, ndigits);
}