summaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-30 16:03:41 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-30 16:03:41 +0000
commit2656d7eadf358bca2eba9d44d7bc83096eb44b59 (patch)
treecbd9b63dab6515ad2b364606cb2e465ff221e48a /numeric.c
parent147e4927fa024ae30751ce825501c0f0a0eaa056 (diff)
downloadruby-2656d7eadf358bca2eba9d44d7bc83096eb44b59.tar.gz
ruby-2656d7eadf358bca2eba9d44d7bc83096eb44b59.tar.xz
ruby-2656d7eadf358bca2eba9d44d7bc83096eb44b59.zip
* numeric.c (num_coerce): call rb_Float(x) first. don't depend on
evaluation order of function arguments. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 187044ee5..ec68f2b34 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