mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Expanded f_quo
This commit is contained in:
parent
f9a0492b76
commit
19006b711d
1 changed files with 10 additions and 1 deletions
11
rational.c
11
rational.c
|
@ -1602,7 +1602,16 @@ f_ceil(VALUE x)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define id_quo rb_intern("quo")
|
#define id_quo rb_intern("quo")
|
||||||
#define f_quo(x,y) rb_funcall((x), id_quo, 1, (y))
|
static VALUE
|
||||||
|
f_quo(VALUE x, VALUE y)
|
||||||
|
{
|
||||||
|
if (RB_INTEGER_TYPE_P(x))
|
||||||
|
return rb_int_div(x, y);
|
||||||
|
if (RB_FLOAT_TYPE_P(x))
|
||||||
|
return DBL2NUM(RFLOAT_VALUE(x) / RFLOAT_VALUE(y));
|
||||||
|
|
||||||
|
return rb_funcallv(x, id_quo, 1, &y);
|
||||||
|
}
|
||||||
|
|
||||||
#define f_reciprocal(x) f_quo(ONE, (x))
|
#define f_reciprocal(x) f_quo(ONE, (x))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue