/*
* call-seq:
* flt.round => integer
*
* Rounds <i>flt</i> to the nearest integer. Equivalent to:
*
* def round
* return floor(self+0.5) if self > 0.0
* return ceil(self-0.5) if self < 0.0
* return 0.0
* end
*
* 1.5.round #=> 2
* (-1.5).round #=> -2
*
*/
static VALUE
flo_round(num)
VALUE num;
{
double f = RFLOAT(num)->value;
long val;
if (f > 0.0) f = floor(f+0.5);
if (f < 0.0) f = ceil(f-0.5);
if (!FIXABLE(f)) {
return rb_dbl2big(f);
}
val = f;
return LONG2FIX(val);
}