From: "H.Yamamoto" Date: 2004-05-27T17:10:26+09:00 Subject: [ruby-dev:23640] test/ruby/test_float.rb (test_symmetry_bignum) failed in BeOS 山本です。BeOSでテストが失敗するので、修正してみました。 どこかで浮動小数点レジスタが関係して比較結果が変わる話を聞いたので、volatile をつけたところ、 テストが通りました。 # あと、本件とは関係ないのですが、テストの表示が [./test/ruby/test_float.rb:52] ではなく、 # [bin/testrb:5] となっています。 $ miniruby -v runruby.rb --ext=".ext" -- bin/testrb test/ruby ruby 1.9.0 (2004-05-26) [i586-beos] Loaded suite ruby Started ..............................................F..................................................................................................................... Finished in 16.121894 seconds. 1) Failure: test_symmetry_bignum(TestFloat) [bin/testrb:5]: expected but was . 164 tests, 1811 assertions, 1 failures, 0 errors Index: bignum.c =================================================================== RCS file: /ruby/ruby/bignum.c,v retrieving revision 1.106 diff -u -w -b -p -r1.106 bignum.c --- bignum.c 7 May 2004 08:44:14 -0000 1.106 +++ bignum.c 27 May 2004 05:58:28 -0000 @@ -982,10 +982,11 @@ rb_big_eq(x, y) break; case T_FLOAT: { - double a, b; + volatile double a, b; a = RFLOAT(y)->value; b = rb_big2dbl(x); + if (isnan(a) || isnan(b)) return Qfalse; return (a == b)?Qtrue:Qfalse; } default: Index: numeric.c =================================================================== RCS file: /ruby/ruby/numeric.c,v retrieving revision 1.110 diff -u -w -b -p -r1.110 numeric.c --- numeric.c 20 May 2004 04:34:07 -0000 1.110 +++ numeric.c 27 May 2004 05:57:13 -0000 @@ -818,7 +818,7 @@ static VALUE flo_eq(x, y) VALUE x, y; { - double a, b; + volatile double a, b; switch (TYPE(y)) { case T_FIXNUM: