[Ruby 1.9 - Bug #368] (Open) 境界瘢雹における Math.atanh 等の動作

e$B%A%1%C%He(B #368 e$B$,Js9p$5$l$^$7$?!#e(B (by Yui NARUSE)


Bug #368: e$B6-3&$K$*$1$ke(B Math.atanh e$BEy$NF0:ne(B
http://redmine.ruby-lang.org/issues/show/368

e$B5/I<<Te(B: Yui NARUSE
e$B%9%F!<%?%9e(B: Open
e$BM%@hEYe(B: Normal
e$BC4Ev<Te(B:
e$B%+%F%4%je(B: core
Target version:

e$B8=:_$Ne(B Ruby trunk e$B$G$O!"e(BFreeBSD 7 e$B$K$*$$$F!"e(B
test/ruby/test_math.rb e$B$O0J2<$N$h$&$K<:GT$7$^$9!#e(B

y% ruby19 test/ruby/test_math.rb
Loaded suite test/ruby/test_math
Started
FFFF
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

e$B$3$l$i$N860x$O$$$:$l$b6-3&$K$*$1$kDj5A$N0c$$$KM3Mh$7$F$$$k$b$N$H;W$o$^$9!#e(B

e$BNc$($P!e(BNetBSD4 [email protected]$He(B atanh
e$B$N%^%K%e%%k$K$O0J2<$N$h$&$K$"$j!"e(B
atanh(1) e$B$Oe(B NaN e$B$H$J$j$^$9!#e(B

RETURN VALUES
If |x|>=1, atanh(x) and atanhf(x) return +inf, -inf or NaN, and
sets the
global variable errno to EDOM.

e$B$7$+$7!"e(BFreeBSD7 e$B$G$O0J2<$N$h$&$K$J$C$F$*$j!"e(Batanh(1)
e$B$Oe(B infinity e$B$rJV$7$^$9!#e(B

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.

e$B;29Me(B:
http://www.hiroshima-cu.ac.jp/japanese/IPC/hunet99/sun/WorkShop/ja/html_docs/common-tools/numerical_comp_guide/standard.doc.html

e$B:XF#$H?=$7$^$9!#e(B

On Mon, 28 Jul 2008 02:56:45 +0900
Yui NARUSE [email protected] wrote:

e$B8=:_$Ne(B Ruby trunk e$B$G$O!"e(BFreeBSD 7 e$B$K$*$$$F!"e(B
test/ruby/test_math.rb e$B$O0J2<$N$h$&$K<:GT$7$^$9!#e(B
(snip)

  1. Failure:
    test_atanh(TestMath) [test/ruby/test_math.rb:97]:
    <[Errno::EDOM, Errno::ERANGE]> exception expected but none was thrown.

e$B;29M$K$J$k$+J,$+$j$^$;$s$,!"e(BC99e$B5,3Je(B(JIS
X3010)e$B$G$b!e(Batanh(1) or atanh(-1) e$B$Ke(B
e$B$D$$$F$O!VCM0h%(%i!<$,H/@8$9$k!X$3$H$,$$k!Y!W$H$7$+=q$$$F$*$i$:!"e(BERANGEe$B$,%;%C%H$5$l$ke(B
e$BJ]>Z$O$J$$$h$&$G$9!#e(B

  1. Failure:
    test_log(TestMath) [test/ruby/test_math.rb:113]:
    <[Errno::EDOM, Errno::ERANGE]> exception expected but none was thrown.

e$B$3$Ne(Blog(0)e$B$K$D$$$F$b!"e(B

  1. Failure:
    test_log10(TestMath) [test/ruby/test_math.rb:129]:
    <[Errno::EDOM, Errno::ERANGE]> exception expected but none was thrown.

e$B$3$Ne(Blog10(0)e$B$K$D$$$F$b!"e(B

  1. Failure:
    test_log2(TestMath) [test/ruby/test_math.rb:121]:
    <[Errno::EDOM, Errno::ERANGE]> exception expected but none was thrown.

e$B$3$Ne(Blog2(0)e$B$K$D$$$F$b!"$$$:$l$bF1MM$N!VH/@8$9$k!X$3$H$,$"$k!Y!W$H$$$&5-=R$G$9!#e(B

e$BNc$($P!e(BNetBSD4 [email protected]$He(B atanh e$B$N%^%K%e%%k$K$O0J2<$N$h$&$K$"$j!"e(B
atanh(1) e$B$Oe(B NaN e$B$H$J$j$^$9!#e(B
(snip)
e$B$7$+$7!"e(BFreeBSD7 e$B$G$O0J2<$N$h$&$K$J$C$F$*$j!"e(Batanh(1) e$B$Oe(B infinity e$B$rJV$7$^$9!#e(B

e$B%F%9%H$r8+$k$H!JV$jCM$O4X78$J$$$H;W$$$^$9$,!$I$&$G$7$g$&$+!#e(B

[email protected]@%$G$9!#e(B

At Mon, 28 Jul 2008 10:24:31 +0900,
Tadashi S. wrote:

test_atanh(TestMath) [test/ruby/test_math.rb:97]:
<[Errno::EDOM, Errno::ERANGE]> exception expected but none was thrown.

e$B;29M$K$J$k$+J,$+$j$^$;$s$,!"e(BC99e$B5,3Je(B(JIS X3010)e$B$G$b!e(Batanh(1) or atanh(-1) e$B$Ke(B
e$B$D$$$F$O!VCM0h%(%i!<$,H/@8$9$k!X$3$H$,$$k!Y!W$H$7$+=q$$$F$*$i$:!"e(BERANGEe$B$,%;%C%H$5$l$ke(B
e$BJ]>Z$O$J$$$h$&$G$9!#e(B

e$B$J$k$[$I!#e(B
e$B$G!"e(BFreeBSDe$B$G$O%;%C%H$5$l$J$$%1!<%9$J$N$G$9$M!#e(B

  1. Failure:
    e$BNc$($P!e(BNetBSD4 [email protected]$He(B atanh e$B$N%^%K%e%%k$K$O0J2<$N$h$&$K$"$j!"e(B
    atanh(1) e$B$Oe(B NaN e$B$H$J$j$^$9!#e(B
    (snip)
    e$B$7$+$7!"e(BFreeBSD7 e$B$G$O0J2<$N$h$&$K$J$C$F$*$j!"e(Batanh(1) e$B$Oe(B infinity e$B$rJV$7$^$9!#e(B

e$B%F%9%H$r8+$k$H!JV$jCM$O4X78$J$$$H;W$$$^$9$,!$I$&$G$7$g$&$+!#e(B

e$B$"!<!"$3$l$r=q$$$F$$$k;[email protected]$G$Oe(BMath.atanhe$B$N<BAu$,F,$K$"$j$^$7$F!"e(B
e$B$=$3$G$Oe(BCe$B$Ne(Batanhe$B$,e(Berrnoe$B$r%;%C%H$7$F$$$k$+!"e(B
[email protected]$C$?$ie(BErrno::EDOMe$B$+e(BErrno::ERANGEe$B$re(B
e$BJV$9$h$&$K$J$C$F$$$k$N$G$9$h!#e(B

e$B$5$F$*$-!"e(BRubye$B$G$O$I$3$K$=$m$($k$N$,$$$$$N$G$9$+$M$!#e(B
Ce$B$N<BAu$r$=$N$^$^H?1G$7$F!"Nc30$rEj$2$:$Ke(BInfinitye$B$rJV$9$N$G$b%F%9%H$rDL$9$H$+!)e(B

[email protected]@%$G$9!#e(B

Tadashi S. wrote:

log*(0)e$B$K$D$$$F$b!"F1MM$N5-=R$Ge(B

If x is e$B!^e(B0, a pole error shall occur

e$B$G$7$?!#$N$G!"$d$O$je(BRubye$BB&$,4hD%$k$N$,K>$^$7$$$N$G$O$J$$$+$H;W$$$^$9!#e(B

e$B$U$`!"$=$l$G$9$H!"$3$s$J46$8$G$9$+$M!#e(B
e$BJQ99FbMFE*$KI{:nMQ$,5$$K$J$C$F$$$?$j$O$9$k$s$G$9$,!#e(B

math.c (revision 18249)
+++ math.c (working copy)
@@ -41,7 +41,7 @@ domain_check(double x, const char *msg)
if (errno) {
rb_sys_fail(msg);
}

  •   if (isnan(x)) {
    
  •   if (isnan(x) || isinf(x)) {
    

#if defined(EDOM)
errno = EDOM;
#elif defined(ERANGE)
@@ -369,9 +369,7 @@ math_log2(VALUE obj, VALUE x)
Need_Float(x);
errno = 0;
d = log2(RFLOAT_VALUE(x));

  • if (errno) {
  •   rb_sys_fail("log2");
    
  • }
  • domain_check(d, log2);
    return DOUBLE2NUM(d);
    }

e$B:XF#$G$9!#e(B

On Mon, 28 Jul 2008 10:51:39 +0900
NARUSE, Yui [email protected] wrote:

e$B$J$k$[$I!#e(B
e$B$G!"e(BFreeBSDe$B$G$O%;%C%H$5$l$J$$%1!<%9$J$N$G$9$M!#e(B

e$B$=$N$h$&$G$9!#e(B

e$B%F%9%H$r8+$k$H!JV$jCM$O4X78$J$$$H;W$$$^$9$,!$I$&$G$7$g$&$+!#e(B

e$B$"!<!"$3$l$r=q$$$F$$$k;[email protected]$G$Oe(BMath.atanhe$B$N<BAu$,F,$K$"$j$^$7$F!"e(B
e$B$=$3$G$Oe(BCe$B$Ne(Batanhe$B$,e(Berrnoe$B$r%;%C%H$7$F$$$k$+!"e(B
[email protected]$C$?$ie(BErrno::EDOMe$B$+e(BErrno::ERANGEe$B$re(B
e$BJV$9$h$&$K$J$C$F$$$k$N$G$9$h!#e(B

e$B$J$k$[$I!"$J$k$[$I!#e(B

e$B$5$F$*$-!"e(BRubye$B$G$O$I$3$K$=$m$($k$N$,$$$$$N$G$9$+$M$!#e(B
Ce$B$N<BAu$r$=$N$^$^H?1G$7$F!"Nc30$rEj$2$:$Ke(BInfinitye$B$rJV$9$N$G$b%F%9%H$rDL$9$H$+!)e(B

e$B5$$r<h$jD>$7$Fe(BSUSv3e$B$r8+$?$N$G$9$,!"e(Batanh(x)e$B$N9`$K$Oe(B

If x is e$B!^e(B1, a pole error shall occur, ()

e$B$H$"$k$N$G!"!Ve([email protected]_Dj$7$J$$e(BFreeBSD
7e$B$N?6$kIq$$$,Nc30E*$G$"$k!W$H$7$Fe(B

Errno::EDOMe$B$+e(BErrno::ERANGEe$B$rJV$9e(B

e$B$H$$$&<BAu$Ke(B(Rubye$BB&$,e(B)e$B$9$kJ}$,NI$$$N$G$O$J$$$G$7$g$&$+!#e(B

log*(0)e$B$K$D$$$F$b!"F1MM$N5-=R$Ge(B

If x is e$B!^e(B0, a pole error shall occur

e$B$G$7$?!#$N$G!"$d$O$je(BRubye$BB&$,4hD%$k$N$,K>$^$7$$$N$G$O$J$$$+$H;W$$$^$9!#e(B

[email protected]@%$G$9!#e(B

NARUSE, Yui wrote:

e$B$U$`!"$=$l$G$9$H!"$3$s$J46$8$G$9$+$M!#e(B
e$BJQ99FbMFE*$KI{:nMQ$,5$$K$J$C$F$$$?$j$O$9$k$s$G$9$,!#e(B

e$BI{:nMQ$,$"$C$?$N$G!"%(%i!<$N=P$k4X?t8DJL$K!"e(B
e$B!V0z?t$,e(B Infinity e$B$G$O$J$$$N$Ke(B e$B7k2L$,e(B
Infinitye$B!W$J>l9g$re(B
e$B%(%i!<$H$9$k$h$&$K$7$F%3%_%C%H$7$^$7$?!#e(B

e$B%A%1%C%He(B #368 e$B$,99?7$5$l$^$7$?!#e(B (by Yui NARUSE)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$BC4Ev<Te(B Yui NARUSEe$B$K%;%C%He(B

e$BNc30$rEj$2$k$h$&$K$7$^$7$?!#e(B

http://redmine.ruby-lang.org/issues/show/368

e$B%A%1%C%He(B #368 e$B$,99?7$5$l$^$7$?!#e(B (by Yui NARUSE)

ruby -v 1.9.2deve$B$K%;%C%He(B

e$B$3$N7o$G$9$,!":G6a%3%_%C%?$K2C$o$C$?e(BMarc-Andre
Lafortunee$B$5$s$,!e(BBug #2189 e$B$G;EMMJQ99$rDs0F$7$F$$$^$9!#e(B
e$B$46=L#$N$$kJ}$O;22C$/[email protected]$5$$!#e(B

e$B$J$!e(BRedminee$B$,$3$N%A%1%C%H$K4XO$9$k:XF#$5$s$N%a!<%k$r=$($F$$$J$$$N$G$3$A$i$b;2>H$/[email protected]$5$$!#e(B
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/35669

http://redmine.ruby-lang.org/issues/show/368

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs