diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2007-05-18 01:52:11 +0400 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2007-05-18 01:52:11 +0400 |
commit | b2250c70bd107d5553d3f5e8d756092f2589ad65 (patch) | |
tree | 6dc71d1fa3bff431715307c9044b93d699e2e040 | |
parent | e0500490bc92e6e851df6f007b1f0943db305846 (diff) |
2007-05-17 Cary R. <cygcary <at> yahoo.com>
* libm/math/w_atan2.c: Fix atan2 to be consistent with glibc
(atan2(+0,-0), atan2(-0,-0) and atan(-0,+0))
* libm/math/wf_atan2.c: Ditto.
-rw-r--r-- | newlib/ChangeLog | 6 | ||||
-rw-r--r-- | newlib/libm/math/w_atan2.c | 27 | ||||
-rw-r--r-- | newlib/libm/math/wf_atan2.c | 25 |
3 files changed, 6 insertions, 52 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 47d5eda38..d2ed17ffe 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,9 @@ +2007-05-17 Cary R. <cygcary <at> yahoo.com> + + * libm/math/w_atan2.c: Fix atan2 to be consistent with glibc + (atan2(+0,-0), atan2(-0,-0) and atan(-0,+0)) + * libm/math/wf_atan2.c: Ditto. + 2007-05-17 Yaakov Selkowitz <yselkowitz <at> users.sourceforge.net> * libm/common/Makefile.am: Add support for exp10, exp10f, diff --git a/newlib/libm/math/w_atan2.c b/newlib/libm/math/w_atan2.c index 25eb1617e..f3e344ea6 100644 --- a/newlib/libm/math/w_atan2.c +++ b/newlib/libm/math/w_atan2.c @@ -60,8 +60,6 @@ RETURNS $-\pi$ to $\pi$. @end tex -If both <[x]> and <[y]> are 0.0, <<atan2>> causes a <<DOMAIN>> error. - You can modify error handling for these functions using <<matherr>>. PORTABILITY @@ -86,32 +84,7 @@ PORTABILITY double y,x; #endif { -#ifdef _IEEE_LIBM return __ieee754_atan2(y,x); -#else - double z; - struct exception exc; - z = __ieee754_atan2(y,x); - if(_LIB_VERSION == _IEEE_||isnan(x)||isnan(y)) return z; - if(x==0.0&&y==0.0) { - /* atan2(+-0,+-0) */ - exc.arg1 = y; - exc.arg2 = x; - exc.type = DOMAIN; - exc.name = "atan2"; - exc.err = 0; - exc.retval = 0.0; - if(_LIB_VERSION == _POSIX_) - errno = EDOM; - else if (!matherr(&exc)) { - errno = EDOM; - } - if (exc.err != 0) - errno = exc.err; - return exc.retval; - } else - return z; -#endif } #endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/newlib/libm/math/wf_atan2.c b/newlib/libm/math/wf_atan2.c index 069a7ca13..eb2a76b1f 100644 --- a/newlib/libm/math/wf_atan2.c +++ b/newlib/libm/math/wf_atan2.c @@ -28,32 +28,7 @@ float y,x; #endif { -#ifdef _IEEE_LIBM return __ieee754_atan2f(y,x); -#else - float z; - struct exception exc; - z = __ieee754_atan2f(y,x); - if(_LIB_VERSION == _IEEE_||isnanf(x)||isnanf(y)) return z; - if(x==(float)0.0&&y==(float)0.0) { - /* atan2f(+-0,+-0) */ - exc.arg1 = y; - exc.arg2 = x; - exc.err = 0; - exc.type = DOMAIN; - exc.name = "atan2f"; - exc.retval = 0.0; - if(_LIB_VERSION == _POSIX_) - errno = EDOM; - else if (!matherr(&exc)) { - errno = EDOM; - } - if (exc.err != 0) - errno = exc.err; - return (float)exc.retval; - } else - return z; -#endif } #ifdef _DOUBLE_IS_32BITS |