public Method

Fixnum.div(p1)

fix / numeric        numeric_result
fix.div(numeric)     numeric_result

Performs division: the class of the resulting object depends on the class of numeric and on the magnitude of the result.

Source Code

/*
* call-seq:
*   fix / numeric      =>  numeric_result
*   fix.div(numeric)   =>  numeric_result
*
* Performs division: the class of the resulting object depends on
* the class of <code>numeric</code> and on the magnitude of the 
* result.
*/

static VALUE
fix_div(x, y)
   VALUE x, y;
{
   if (FIXNUM_P(y)) {
       long div;

       fixdivmod(FIX2LONG(x), FIX2LONG(y), &div, 0);
       return LONG2NUM(div);
   }
   return rb_num_coerce_bin(x, y);
}
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.