From 5f8e0b66330ece522adb41c1e5d09babdb0cf7d2 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 30 Jun 2008 16:03:41 +0000 Subject: * numeric.c (num_coerce): call rb_Float(x) first. don't depend on evaluation order of function arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'numeric.c') 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 -- cgit v1.2.3