diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-07-22 13:04:25 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-07-22 13:04:25 +0000 |
commit | 210bf4dc6e6c7961cb48fae3463271fe17d00667 (patch) | |
tree | 76c10dd33e9468c0c5bb019484951d76f1ff4ab2 /numeric.c | |
parent | ef43ac0d05e4c6262e43f152d735df34e431537c (diff) |
* bignum.c (rb_big_eq): reduce isnan(). [ruby-dev:26600]
* numeric.c (flo_eq, flo_gt, flo_ge, flo_lt, flo_le): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -832,12 +832,13 @@ flo_eq(x, y) break; case T_FLOAT: b = RFLOAT(y)->value; + if (isnan(b)) return Qfalse; break; default: return num_equal(x, y); } a = RFLOAT(x)->value; - if (isnan(a) || isnan(b)) return Qfalse; + if (isnan(a)) return Qfalse; return (a == b)?Qtrue:Qfalse; } @@ -937,12 +938,13 @@ flo_gt(x, y) case T_FLOAT: b = RFLOAT(y)->value; + if (isnan(b)) return Qfalse; break; default: return rb_num_coerce_relop(x, y); } - if (isnan(a) || isnan(b)) return Qfalse; + if (isnan(a)) return Qfalse; return (a > b)?Qtrue:Qfalse; } @@ -972,12 +974,13 @@ flo_ge(x, y) case T_FLOAT: b = RFLOAT(y)->value; + if (isnan(b)) return Qfalse; break; default: return rb_num_coerce_relop(x, y); } - if (isnan(a) || isnan(b)) return Qfalse; + if (isnan(a)) return Qfalse; return (a >= b)?Qtrue:Qfalse; } @@ -1006,12 +1009,13 @@ flo_lt(x, y) case T_FLOAT: b = RFLOAT(y)->value; + if (isnan(b)) return Qfalse; break; default: return rb_num_coerce_relop(x, y); } - if (isnan(a) || isnan(b)) return Qfalse; + if (isnan(a)) return Qfalse; return (a < b)?Qtrue:Qfalse; } @@ -1041,12 +1045,13 @@ flo_le(x, y) case T_FLOAT: b = RFLOAT(y)->value; + if (isnan(b)) return Qfalse; break; default: return rb_num_coerce_relop(x, y); } - if (isnan(a) || isnan(b)) return Qfalse; + if (isnan(a)) return Qfalse; return (a <= b)?Qtrue:Qfalse; } |