diff --git a/ChangeLog b/ChangeLog index fc4c4c3da8..33e684f37d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jul 1 00:59:43 2008 Tanaka Akira + + * numeric.c (num_coerce): call rb_Float(x) first. don't depend on + evaluation order of function arguments. + Tue Jul 1 00:49:11 2008 Nobuyoshi Nakada * gc.c (rb_newobj): abort GC phase before rb_bug. diff --git a/numeric.c b/numeric.c index 187044ee5e..ec68f2b348 100644 --- a/numeric.c +++ b/numeric.c @@ -118,7 +118,9 @@ num_coerce(VALUE x, VALUE y) { if (CLASS_OF(x) == CLASS_OF(y)) return rb_assoc_new(y, x); - return rb_assoc_new(rb_Float(y), rb_Float(x)); + x = rb_Float(x); + y = rb_Float(y); + return rb_assoc_new(y, x); } static VALUE