mirror of
git://git.musl-libc.org/musl
synced 2025-03-29 22:57:17 +00:00
fix incorrect results for catanf and catanl with some inputs
catan was fixed in 10e4bd3780
but the
same bug in catanf and catanl was overlooked. the patch is completely
analogous.
This commit is contained in:
parent
329e79299d
commit
1102062081
@ -87,29 +87,17 @@ float complex catanf(float complex z)
|
||||
x = crealf(z);
|
||||
y = cimagf(z);
|
||||
|
||||
if ((x == 0.0f) && (y > 1.0f))
|
||||
goto ovrf;
|
||||
|
||||
x2 = x * x;
|
||||
a = 1.0f - x2 - (y * y);
|
||||
if (a == 0.0f)
|
||||
goto ovrf;
|
||||
|
||||
t = 0.5f * atan2f(2.0f * x, a);
|
||||
w = _redupif(t);
|
||||
|
||||
t = y - 1.0f;
|
||||
a = x2 + (t * t);
|
||||
if (a == 0.0f)
|
||||
goto ovrf;
|
||||
|
||||
t = y + 1.0f;
|
||||
a = (x2 + (t * t))/a;
|
||||
w = w + (0.25f * logf (a)) * I;
|
||||
return w;
|
||||
|
||||
ovrf:
|
||||
// FIXME
|
||||
w = MAXNUMF + MAXNUMF * I;
|
||||
w = CMPLXF(w, 0.25f * logf(a));
|
||||
return w;
|
||||
}
|
||||
|
@ -97,30 +97,18 @@ long double complex catanl(long double complex z)
|
||||
x = creall(z);
|
||||
y = cimagl(z);
|
||||
|
||||
if ((x == 0.0L) && (y > 1.0L))
|
||||
goto ovrf;
|
||||
|
||||
x2 = x * x;
|
||||
a = 1.0L - x2 - (y * y);
|
||||
if (a == 0.0L)
|
||||
goto ovrf;
|
||||
|
||||
t = atan2l(2.0L * x, a) * 0.5L;
|
||||
w = redupil(t);
|
||||
|
||||
t = y - 1.0L;
|
||||
a = x2 + (t * t);
|
||||
if (a == 0.0L)
|
||||
goto ovrf;
|
||||
|
||||
t = y + 1.0L;
|
||||
a = (x2 + (t * t)) / a;
|
||||
w = w + (0.25L * logl(a)) * I;
|
||||
return w;
|
||||
|
||||
ovrf:
|
||||
// FIXME
|
||||
w = LDBL_MAX + LDBL_MAX * I;
|
||||
w = CMPLXF(w, 0.25L * logl(a));
|
||||
return w;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user