round() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
static VALUE
nurat_round(VALUE self)

    if (f_negative_p(dat->num)) {
        VALUE num, den;

        num = f_negate(dat->num);
        num = f_add(f_mul(num, TWO), dat->den);
        den = f_mul(dat->den, TWO);
        return f_negate(f_idiv(num, den));
    else {
        VALUE num = f_add(f_mul(dat->num, TWO), dat->den);
        VALUE den = f_mul(dat->den, TWO);
        return f_idiv(num, den);
Register or log in to add new notes.