Project

General

Profile

Actions

Bug #368

closed

境界における Math.atanh 等の動作

Added by naruse (Yui NARUSE) over 16 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.9.2dev
Backport:
[ruby-dev:35669]

Description

=begin
現在の 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
=end


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an errorClosedmatz (Yukihiro Matsumoto)10/10/2009Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0