summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-22 13:04:25 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-22 13:04:25 +0000
commit6dbb35a1a05fa0633278f992b8a813d01f9d54fc (patch)
tree76c10dd33e9468c0c5bb019484951d76f1ff4ab2
parentf7e1f7678269aa7dbb49a48a394b9cecd767cc8f (diff)
downloadruby-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--ChangeLog6
-rw-r--r--bignum.c2
-rw-r--r--numeric.c15
3 files changed, 17 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 08286d681..01adb660d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/bignum.c b/bignum.c
index ae748fc86..948e16234 100644
--- a/bignum.c
+++ b/bignum.c
@@ -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:
diff --git a/numeric.c b/numeric.c
index e5a03e1a8..eb528e932 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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;
}