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 | 6dbb35a1a05fa0633278f992b8a813d01f9d54fc (patch) | |
tree | 76c10dd33e9468c0c5bb019484951d76f1ff4ab2 | |
parent | f7e1f7678269aa7dbb49a48a394b9cecd767cc8f (diff) | |
download | ruby-6dbb35a1a05fa0633278f992b8a813d01f9d54fc.tar.gz ruby-6dbb35a1a05fa0633278f992b8a813d01f9d54fc.tar.xz ruby-6dbb35a1a05fa0633278f992b8a813d01f9d54fc.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | bignum.c | 2 | ||||
-rw-r--r-- | numeric.c | 15 |
3 files changed, 17 insertions, 6 deletions
@@ -1,3 +1,9 @@ +Fri Jul 22 21:06:08 2005 Tadashi Saito <shiba@mail2.accsnet.ne.jp> + + * bignum.c (rb_big_eq): reduce isnan(). [ruby-dev:26600] + + * numeric.c (flo_eq, flo_gt, flo_ge, flo_lt, flo_le): ditto. + Fri Jul 22 15:02:39 2005 Kouhei Sutou <kou@cozmixng.org> * lib/rss/rss.rb: moved copyright description to lib/rss.rb. @@ -979,8 +979,8 @@ rb_big_eq(x, y) volatile double a, b; a = RFLOAT(y)->value; + if (isnan(a)) return Qfalse; b = rb_big2dbl(x); - if (isnan(a) || isnan(b)) return Qfalse; return (a == b)?Qtrue:Qfalse; } default: @@ -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; } |