[Bug:trunk] boundary case of acosh() in missing/acosh.c

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

e$BK\Ev$K%P%0$J$N$+$I$&$+$h$/$o$+$j$^$;$s$,!"e(Bmissing/acosh.ce$BFb$Ne(B
atanhe$B$O!“0z?t$,e(B1.0e$B$^$?$Oe(B-1.0e$B$N;~!“e(BInfe$B$^$?$Oe(B-Infe$B$rJV$7!”$+$D!“e(B
errnoe$B$r%;%C%H$7$^$;$s!#e(B
C99e$B$de(BSUSv3e$B$r8+$k$H!”$3$N>l9g$Oe(Berrnoe$B$Ke(BERANGEe$B$,@_Dj$5$l$k$N$,@5e(B
e$B$7$$5$$,$7$^$9$7!”$^$?!"e(Btest/ruby/test_math.rbe$B$Ne(Btest_atanhe$B$be(B
e$B$=$&$J$k$3$H$r4|BT$7$F$$$k$h$&$K8+$($^$9!#e(B

e$B$H$$$&$o$1$G!“0J2<$N%Q%C%A$N$h$&$KJQ99$9$Y$-$J$N$G$O$J$$$+$He(B
e$B;W$&$N$G$9$,!”$I$&$G$7$g$&$+!#e(B

Index: missing/acosh.c

— missing/acosh.c (revision 17414)
+++ missing/acosh.c (working copy)
@@ -12,6 +12,7 @@
#include <errno.h>
#include <float.h>
#include <math.h>
+#include “ruby.h”

/* DBL_MANT_DIG must be less than 4 times of bits of int */
#ifndef DBL_MANT_DIG
@@ -79,6 +80,14 @@ atanh(double x)
if (z < SMALL_CRITERIA) return x;
z = log(z > 1 ? -1 : (1 + z) / (1 - z)) / 2;
if (neg) z = -z;

  • if (isinf(z))
    +#if defined(ERANGE)
  • errno = ERANGE;
    +#elif defined(EDOM)
  • errno = EDOM;
    +#else
  • ;
    +#endif
    return z;
    }
    #endif

e$B$=$l$G$O!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:35155] [Bug:trunk] boundary case of acosh() in
missing/acosh.c”
on Wed, 18 Jun 2008 20:06:23 +0900, “U.Nakamura”
[email protected] writes:

|e$BK\Ev$K%P%0$J$N$+$I$&$+$h$/$o$+$j$^$;$s$,!"e(Bmissing/acosh.ce$BFb$Ne(B
|atanhe$B$O!“0z?t$,e(B1.0e$B$^$?$Oe(B-1.0e$B$N;~!“e(BInfe$B$^$?$Oe(B-Infe$B$rJV$7!”$+$D!“e(B
|errnoe$B$r%;%C%H$7$^$;$s!#e(B
|C99e$B$de(BSUSv3e$B$r8+$k$H!”$3$N>l9g$Oe(Berrnoe$B$Ke(BERANGEe$B$,@_Dj$5$l$k$N$,@5e(B
|e$B$7$$5$$,$7$^$9$7!”$^$?!"e(Btest/ruby/test_math.rbe$B$Ne(Btest_atanhe$B$be(B
|e$B$=$&$J$k$3$H$r4|BT$7$F$$$k$h$&$K8+$($^$9!#e(B
|
|e$B$H$$$&$o$1$G!“0J2<$N%Q%C%A$N$h$&$KJQ99$9$Y$-$J$N$G$O$J$$$+$He(B
|e$B;W$&$N$G$9$,!”$I$&$G$7$g$&$+!#e(B

e$B%3%_%C%H$7$F$/$@$5$$!#H?BP$,$"$l$P%j%P!<%H$9$k$H$$$&$3$H$G!#e(B

e$B%A%1%C%He(B #189 e$B$,99?7$5$l$^$7$?!#e(B (by Usaku NAKAMURA)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r17425.

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