NetBSD-Bugs archive

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

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

>Number:         42630
>Category:       lib
>Synopsis:       asin(2.0) and acos(2.0) doesn't return NaN
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 17 11:25:00 +0000 2010
>Originator:     NARUSE, Yui
>Release:        5.0.1
NetBSD kelvena 5.0.1 NetBSD 5.0.1 (GENERIC) #0: Thu Jul 30 01:39:11 UTC 2009
On NetBSD 5.0.1 (i386) asin(2.0) and acos(2.0) return 0.0.
(and set errno as EDOM)

This conflicts asin's man:
     If |x|>1, asin(x) and asinf(x) return NaN and set the global variable
     errno to EDOM.
(acos's man doesn't descrive about return value if |x| > 1)

And lib/libm/src/e_asin.c's comment:
 * Special cases:
 *      if x is NaN, return x itself;
 *      if |x|>1, return NaN with invalid signal.
(e_acos.c also has same comment)

This seems because of the bug of lib/libm/arch/i387/e_asin.S.
(and lib/libm/arch/i387/e_acos.S)
$ cat t.c
#include <stdio.h>
#include <math.h>
#include <errno.h>

int main(void)
  double r;
  errno = 0;
  r = asin(2.0);
  printf("r: %f isnan:%d errno:%d\n", r, isnan(r), errno);
  return 0;
$ cc -lm t.c
$ ./a.out
r: 0.000000 isnan:0 errno:33


Home | Main Index | Thread Index | Old Index