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

* 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/trunk@8831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-07-25 07:08:14 +00:00
parent b535e9b004
commit f65273b419
3 changed files with 17 additions and 6 deletions

View file

@ -19,6 +19,12 @@ Sat Jul 23 10:01:41 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* missing/vsnprintf.c: made the output changeable. * missing/vsnprintf.c: made the output changeable.
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> Fri Jul 22 15:02:39 2005 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/rss.rb: moved copyright description to lib/rss.rb. * lib/rss/rss.rb: moved copyright description to lib/rss.rb.

View file

@ -983,8 +983,8 @@ rb_big_eq(x, y)
volatile double a, b; volatile double a, b;
a = RFLOAT(y)->value; a = RFLOAT(y)->value;
if (isnan(a)) return Qfalse;
b = rb_big2dbl(x); b = rb_big2dbl(x);
if (isnan(a) || isnan(b)) return Qfalse;
return (a == b)?Qtrue:Qfalse; return (a == b)?Qtrue:Qfalse;
} }
default: default:

View file

@ -833,12 +833,13 @@ flo_eq(x, y)
break; break;
case T_FLOAT: case T_FLOAT:
b = RFLOAT(y)->value; b = RFLOAT(y)->value;
if (isnan(b)) return Qfalse;
break; break;
default: default:
return num_equal(x, y); return num_equal(x, y);
} }
a = RFLOAT(x)->value; a = RFLOAT(x)->value;
if (isnan(a) || isnan(b)) return Qfalse; if (isnan(a)) return Qfalse;
return (a == b)?Qtrue:Qfalse; return (a == b)?Qtrue:Qfalse;
} }
@ -938,12 +939,13 @@ flo_gt(x, y)
case T_FLOAT: case T_FLOAT:
b = RFLOAT(y)->value; b = RFLOAT(y)->value;
if (isnan(b)) return Qfalse;
break; break;
default: default:
return rb_num_coerce_relop(x, y); return rb_num_coerce_relop(x, y);
} }
if (isnan(a) || isnan(b)) return Qfalse; if (isnan(a)) return Qfalse;
return (a > b)?Qtrue:Qfalse; return (a > b)?Qtrue:Qfalse;
} }
@ -973,12 +975,13 @@ flo_ge(x, y)
case T_FLOAT: case T_FLOAT:
b = RFLOAT(y)->value; b = RFLOAT(y)->value;
if (isnan(b)) return Qfalse;
break; break;
default: default:
return rb_num_coerce_relop(x, y); return rb_num_coerce_relop(x, y);
} }
if (isnan(a) || isnan(b)) return Qfalse; if (isnan(a)) return Qfalse;
return (a >= b)?Qtrue:Qfalse; return (a >= b)?Qtrue:Qfalse;
} }
@ -1007,12 +1010,13 @@ flo_lt(x, y)
case T_FLOAT: case T_FLOAT:
b = RFLOAT(y)->value; b = RFLOAT(y)->value;
if (isnan(b)) return Qfalse;
break; break;
default: default:
return rb_num_coerce_relop(x, y); return rb_num_coerce_relop(x, y);
} }
if (isnan(a) || isnan(b)) return Qfalse; if (isnan(a)) return Qfalse;
return (a < b)?Qtrue:Qfalse; return (a < b)?Qtrue:Qfalse;
} }
@ -1042,12 +1046,13 @@ flo_le(x, y)
case T_FLOAT: case T_FLOAT:
b = RFLOAT(y)->value; b = RFLOAT(y)->value;
if (isnan(b)) return Qfalse;
break; break;
default: default:
return rb_num_coerce_relop(x, y); return rb_num_coerce_relop(x, y);
} }
if (isnan(a) || isnan(b)) return Qfalse; if (isnan(a)) return Qfalse;
return (a <= b)?Qtrue:Qfalse; return (a <= b)?Qtrue:Qfalse;
} }