diff options
author | NARUSE, Yui <naruse@airemix.jp> | 2019-11-07 18:48:51 +0900 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2019-11-07 18:50:35 +0900 |
commit | 26843cbcd0b97489f98aa123e700c4e893b1da5e (patch) | |
tree | 8f83b16baa1afa4311cdcdd3db19d1e97c17e473 | |
parent | d45a013a1a3bcc860e6f7f303220b3297e2abdbc (diff) | |
download | ruby-26843cbcd0b97489f98aa123e700c4e893b1da5e.tar.gz |
Use FIX2LONG to avoid unexpected exception
Though it won't happen in the real world in this context, FIX2INT may
raise an exception and it cause to generate extra code.
-rw-r--r-- | numeric.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1461,7 +1461,7 @@ flo_cmp(VALUE x, VALUE y) if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) { VALUE rel = rb_integer_float_cmp(y, x); if (FIXNUM_P(rel)) - return INT2FIX(-FIX2INT(rel)); + return LONG2FIX(-FIX2LONG(rel)); return rel; } else if (RB_TYPE_P(y, T_FLOAT)) { |