Print this page
11175 libm should use signbit() correctly
11188 c99 math macros should return strictly backward compatible values
*** 71,91 ****
PIo2 = 1.570796326794896619231321691639751442099L,
PI = 3.141592653589793238462643383279502884197L,
PI_lo = 8.671810130123781024797044026043351968762e-35L;
long double
! atan2l(long double y, long double x) {
long double t, z;
int k, m, signy, signx;
if (x != x || y != y)
return (x + y); /* return NaN if x or y is NAN */
signy = signbitl(y);
signx = signbitl(x);
if (x == one)
return (atanl(y));
! m = signy + signx + signx;
/* when y = 0 */
if (y == zero)
switch (m) {
case 0:
--- 71,93 ----
PIo2 = 1.570796326794896619231321691639751442099L,
PI = 3.141592653589793238462643383279502884197L,
PI_lo = 8.671810130123781024797044026043351968762e-35L;
long double
! atan2l(long double y, long double x)
! {
long double t, z;
int k, m, signy, signx;
if (x != x || y != y)
return (x + y); /* return NaN if x or y is NAN */
signy = signbitl(y);
signx = signbitl(x);
if (x == one)
return (atanl(y));
! /* Ensure sign indicators are boolean */
! m = (signy != 0) + (signx != 0) + (signx != 0);
/* when y = 0 */
if (y == zero)
switch (m) {
case 0:
*** 98,108 ****
return (-PI - tiny); /* atan(-0,-anything) */
}
/* when x = 0 */
if (x == zero)
! return (signy == 1 ? -PIo2 - tiny : PIo2 + tiny);
/* when x is INF */
if (!finitel(x)) {
if (!finitel(y)) {
switch (m) {
--- 100,110 ----
return (-PI - tiny); /* atan(-0,-anything) */
}
/* when x = 0 */
if (x == zero)
! return (signy != 0 ? -PIo2 - tiny : PIo2 + tiny);
/* when x is INF */
if (!finitel(x)) {
if (!finitel(y)) {
switch (m) {
*** 128,138 ****
}
}
}
/* when y is INF */
if (!finitel(y))
! return (signy == 1 ? -PIo2 - tiny : PIo2 + tiny);
/* compute y/x */
x = fabsl(x);
y = fabsl(y);
t = PI_lo;
--- 130,140 ----
}
}
}
/* when y is INF */
if (!finitel(y))
! return (signy != 0 ? -PIo2 - tiny : PIo2 + tiny);
/* compute y/x */
x = fabsl(x);
y = fabsl(y);
t = PI_lo;
*** 154,160 ****
return (PI - (z - t)); /* atan(+,-) */
case 3:
return ((z - t) - PI); /* atan(-,-) */
}
/* NOTREACHED */
! return 0.0L;
}
--- 156,162 ----
return (PI - (z - t)); /* atan(+,-) */
case 3:
return ((z - t) - PI); /* atan(-,-) */
}
/* NOTREACHED */
! return (0.0L);
}