NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/42630: asin(2.0) and acos(2.0) doesn't return NaN



hi, naruse-san.

this is because of __kernel_standard(x, x, 2) returns zero.
please try following patch.


Index: src/k_standard.c
===================================================================
RCS file: /cvsroot/src/lib/libm/src/k_standard.c,v
retrieving revision 1.12
diff -u -r1.12 k_standard.c
--- src/k_standard.c    21 Jul 2005 16:58:39 -0000      1.12
+++ src/k_standard.c    18 Jan 2010 17:24:19 -0000
@@ -118,9 +118,12 @@
                exc.type = DOMAIN;
                exc.name = type < 100 ? "asin" : "asinf";
                exc.retval = zero;
-               if(_LIB_VERSION == _POSIX_)
+               if(_LIB_VERSION == _POSIX_) {
+#ifndef __vax__
+                 exc.retval = NAN;
+#endif
                  errno = EDOM;
-               else if (!matherr(&exc)) {
+               } else if (!matherr(&exc)) {
                  if(_LIB_VERSION == _SVID_) {
                        (void) WRITE2("asin: DOMAIN error\n", 19);
                  }
@@ -135,9 +138,12 @@
                exc.type = DOMAIN;
                exc.name = type < 100 ? "atan2" : "atan2f";
                exc.retval = zero;
-               if(_LIB_VERSION == _POSIX_)
+               if(_LIB_VERSION == _POSIX_) {
+#ifndef __vax__
+                 exc.retval = NAN;
+#endif
                  errno = EDOM;
-               else if (!matherr(&exc)) {
+               } else if (!matherr(&exc)) {
                  if(_LIB_VERSION == _SVID_) {
                        (void) WRITE2("atan2: DOMAIN error\n", 20);
                      }


very truly yours.
--
Takehiko NOZAKI <tnozaki%NetBSD.org@localhost>


Home | Main Index | Thread Index | Old Index