From 35f837311e2a52051dc1cd6a8abd2bd5a3cce2ed Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Fri, 9 Dec 2011 13:10:48 -0800 Subject: [PATCH] numeric.c (num_quo): Convert to Rational using #to_r. --- ChangeLog | 3 +++ numeric.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea756b0..2a0e88f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Fri Dec 9 13:04:44 2011 John Firebaugh + * numeric.c (num_quo): Convert to Rational using #to_r. + Fri Dec 9 19:24:31 2011 NARUSE, Yui * enc/trans/iso-8859-16-tbl.rb: add ISO-8859-16 converter. diff --git a/numeric.c b/numeric.c index 53d8582..041dbb1d 100644 --- a/numeric.c +++ b/numeric.c @@ -100,7 +100,7 @@ static VALUE fix_uminus(VALUE num); static VALUE fix_mul(VALUE x, VALUE y); static VALUE int_pow(long x, unsigned long y); -static ID id_coerce, id_to_i, id_eq; +static ID id_coerce, id_to_i, id_to_r, id_eq; VALUE rb_cNumeric; VALUE rb_cFloat; @@ -328,7 +328,7 @@ num_uminus(VALUE num) static VALUE num_quo(VALUE x, VALUE y) { - return rb_funcall(rb_rational_raw1(x), '/', 1, y); + return rb_funcall(rb_funcall(x, id_to_r, 0), '/', 1, y); } @@ -3539,6 +3539,7 @@ Init_Numeric(void) #endif id_coerce = rb_intern("coerce"); id_to_i = rb_intern("to_i"); + id_to_r = rb_intern("to_r"); id_eq = rb_intern("=="); rb_eZeroDivError = rb_define_class("ZeroDivisionError", rb_eStandardError); -- 1.7.6