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