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



The following reply was made to PR lib/42630; it has been noted by GNATS.

From: Takehiko NOZAKI <takehiko.nozaki%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, 
netbsd-bugs%netbsd.org@localhost
Subject: Re: lib/42630: asin(2.0) and acos(2.0) doesn't return NaN
Date: Tue, 19 Jan 2010 02:30:01 +0900

 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