From: Yui NARUSE Date: 2008-07-28T02:56:45+09:00 Subject: [ruby-dev:35669] [Ruby 1.9 - Bug #368] (Open) 境界における Math.atanh 等の動作 チケット #368 が報告されました。 (by Yui NARUSE) ---------------------------------------- Bug #368: 境界における Math.atanh 等の動作 http://redmine.ruby-lang.org/issues/show/368 起票者: Yui NARUSE ステータス: Open 優先度: Normal 担当者: カテゴリ: core Target version: 現在の Ruby trunk では、FreeBSD 7 において、 test/ruby/test_math.rb は以下のように失敗します。 y% ruby19 test/ruby/test_math.rb Loaded suite test/ruby/test_math Started ......F...........FFF..... Finished in 0.036791548 seconds. 1) Failure: test_atanh(TestMath) [test/ruby/test_math.rb:97]: <[Errno::EDOM, Errno::ERANGE]> exception expected but none was thrown. 2) Failure: test_log(TestMath) [test/ruby/test_math.rb:113]: <[Errno::EDOM, Errno::ERANGE]> exception expected but none was thrown. 3) Failure: test_log10(TestMath) [test/ruby/test_math.rb:129]: <[Errno::EDOM, Errno::ERANGE]> exception expected but none was thrown. 4) Failure: test_log2(TestMath) [test/ruby/test_math.rb:121]: <[Errno::EDOM, Errno::ERANGE]> exception expected but none was thrown. 26 tests, 126 assertions, 4 failures, 0 errors これらの原因はいずれも境界における定義の違いに由来しているものと思わます。 例えば、NetBSD4 だと atanh のマニュアルには以下のようにあり、 atanh(1) は NaN となります。 RETURN VALUES If |x|>=1, atanh(x) and atanhf(x) return +inf, -inf or NaN, and sets the global variable errno to EDOM. しかし、FreeBSD7 では以下のようになっており、atanh(1) は infinity を返します。 RETURN VALUES The atanh() and the atanhf() functions return the inverse hyperbolic tan- gent of x if successful. If the argument has absolute value 1, a divide- by-zero exception is raised and an infinity is returned. If |x| > 1, an invalid exception is raised and an NaN is returned. 参考: http://www.hiroshima-cu.ac.jp/japanese/IPC/hunet99/sun/WorkShop/ja/html_docs/common-tools/numerical_comp_guide/standard.doc.html ---------------------------------------- http://redmine.ruby-lang.org