1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
akr 2008-06-30 16:03:41 +00:00
parent 4c4357c698
commit 5f8e0b6633
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Tue Jul 1 00:59:43 2008 Tanaka Akira <akr@fsij.org>
* 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 <nobu@ruby-lang.org> Tue Jul 1 00:49:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (rb_newobj): abort GC phase before rb_bug. * gc.c (rb_newobj): abort GC phase before rb_bug.

View file

@ -118,7 +118,9 @@ num_coerce(VALUE x, VALUE y)
{ {
if (CLASS_OF(x) == CLASS_OF(y)) if (CLASS_OF(x) == CLASS_OF(y))
return rb_assoc_new(y, x); 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 static VALUE