Source-Changes-HG archive

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

[src/trunk]: src/lib/libm/src fix return values for atan2(+-0, +-0) in the POS...



details:   https://anonhg.NetBSD.org/src/rev/63e864596b78
branches:  trunk
changeset: 751198:63e864596b78
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Jan 27 20:23:53 2010 +0000

description:
fix return values for atan2(+-0,+-0) in the POSIX case

diffstat:

 lib/libm/src/k_standard.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r 119c4947dbda -r 63e864596b78 lib/libm/src/k_standard.c
--- a/lib/libm/src/k_standard.c Wed Jan 27 20:16:16 2010 +0000
+++ b/lib/libm/src/k_standard.c Wed Jan 27 20:23:53 2010 +0000
@@ -12,7 +12,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_standard.c,v 1.14 2010/01/20 16:49:42 drochner Exp $");
+__RCSID("$NetBSD: k_standard.c,v 1.15 2010/01/27 20:23:53 drochner Exp $");
 #endif
 
 #include "math.h"
@@ -137,9 +137,10 @@
                exc.type = DOMAIN;
                exc.name = type < 100 ? "atan2" : "atan2f";
                exc.retval = zero;
-               if(_LIB_VERSION == _POSIX_)
+               if(_LIB_VERSION == _POSIX_) {
+                 exc.retval = copysign(signbit(y) ? M_PI : zero, x);
                  errno = EDOM;
-               else if (!matherr(&exc)) {
+               } else if (!matherr(&exc)) {
                  if(_LIB_VERSION == _SVID_) {
                        (void) WRITE2("atan2: DOMAIN error\n", 20);
                      }



Home | Main Index | Thread Index | Old Index