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.
This commit is contained in:
Jeff Johnston 2007-05-17 21:52:11 +00:00
parent e0500490bc
commit b2250c70bd
3 changed files with 6 additions and 52 deletions

View File

@ -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> 2007-05-17 Yaakov Selkowitz <yselkowitz <at> users.sourceforge.net>
* libm/common/Makefile.am: Add support for exp10, exp10f, * libm/common/Makefile.am: Add support for exp10, exp10f,

View File

@ -60,8 +60,6 @@ RETURNS
$-\pi$ to $\pi$. $-\pi$ to $\pi$.
@end tex @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>>. You can modify error handling for these functions using <<matherr>>.
PORTABILITY PORTABILITY
@ -86,32 +84,7 @@ PORTABILITY
double y,x; double y,x;
#endif #endif
{ {
#ifdef _IEEE_LIBM
return __ieee754_atan2(y,x); 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) */ #endif /* defined(_DOUBLE_IS_32BITS) */

View File

@ -28,32 +28,7 @@
float y,x; float y,x;
#endif #endif
{ {
#ifdef _IEEE_LIBM
return __ieee754_atan2f(y,x); 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 #ifdef _DOUBLE_IS_32BITS