1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Use suffixed floating-point constants in float and long double catan/catanh.

This commit is contained in:
Joseph Myers
2013-04-24 18:59:37 +00:00
parent 2f38fbfe09
commit 77f143fdb4
5 changed files with 34 additions and 28 deletions

View File

@ -1,5 +1,11 @@
2013-04-24 Joseph Myers <joseph@codesourcery.com> 2013-04-24 Joseph Myers <joseph@codesourcery.com>
* math/s_catanf.c (__catanf): Use suffixed floating-point
constants.
* math/s_catanhf.c (__catanhf): Likewise.
* math/s_catanhl.c (__catanhl): Likewise.
* math/s_catanl.c (__catanl): Likewise.
[BZ #15394] [BZ #15394]
* math/s_catan.c (__catan): Calculate imaginary part of result * math/s_catan.c (__catan): Calculate imaginary part of result
with log1p not log unless computing log of number close to 0. with log1p not log unless computing log of number close to 0.

View File

@ -67,21 +67,21 @@ __catanf (__complex__ float x)
den = 1 - r2 - __imag__ x * __imag__ x; den = 1 - r2 - __imag__ x * __imag__ x;
__real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den); __real__ res = 0.5f * __ieee754_atan2f (2.0f * __real__ x, den);
num = __imag__ x + 1.0; num = __imag__ x + 1.0f;
num = r2 + num * num; num = r2 + num * num;
den = __imag__ x - 1.0; den = __imag__ x - 1.0f;
den = r2 + den * den; den = r2 + den * den;
f = num / den; f = num / den;
if (f < 0.5) if (f < 0.5f)
__imag__ res = 0.25 * __ieee754_logf (f); __imag__ res = 0.25f * __ieee754_logf (f);
else else
{ {
num = 4.0 * __imag__ x; num = 4.0f * __imag__ x;
__imag__ res = 0.25 * __log1pf (num / den); __imag__ res = 0.25f * __log1pf (num / den);
} }
} }

View File

@ -58,24 +58,24 @@ __catanhf (__complex__ float x)
{ {
float i2 = __imag__ x * __imag__ x; float i2 = __imag__ x * __imag__ x;
float num = 1.0 + __real__ x; float num = 1.0f + __real__ x;
num = i2 + num * num; num = i2 + num * num;
float den = 1.0 - __real__ x; float den = 1.0f - __real__ x;
den = i2 + den * den; den = i2 + den * den;
float f = num / den; float f = num / den;
if (f < 0.5) if (f < 0.5f)
__real__ res = 0.25 * __ieee754_logf (f); __real__ res = 0.25f * __ieee754_logf (f);
else else
{ {
num = 4.0 * __real__ x; num = 4.0f * __real__ x;
__real__ res = 0.25 * __log1pf (num / den); __real__ res = 0.25f * __log1pf (num / den);
} }
den = 1 - __real__ x * __real__ x - i2; den = 1 - __real__ x * __real__ x - i2;
__imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den); __imag__ res = 0.5f * __ieee754_atan2f (2.0f * __imag__ x, den);
} }
return res; return res;

View File

@ -58,24 +58,24 @@ __catanhl (__complex__ long double x)
{ {
long double i2 = __imag__ x * __imag__ x; long double i2 = __imag__ x * __imag__ x;
long double num = 1.0 + __real__ x; long double num = 1.0L + __real__ x;
num = i2 + num * num; num = i2 + num * num;
long double den = 1.0 - __real__ x; long double den = 1.0L - __real__ x;
den = i2 + den * den; den = i2 + den * den;
long double f = num / den; long double f = num / den;
if (f < 0.5) if (f < 0.5L)
__real__ res = 0.25 * __ieee754_logl (f); __real__ res = 0.25L * __ieee754_logl (f);
else else
{ {
num = 4.0 * __real__ x; num = 4.0L * __real__ x;
__real__ res = 0.25 * __log1pl (num / den); __real__ res = 0.25L * __log1pl (num / den);
} }
den = 1 - __real__ x * __real__ x - i2; den = 1 - __real__ x * __real__ x - i2;
__imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den); __imag__ res = 0.5L * __ieee754_atan2l (2.0L * __imag__ x, den);
} }
return res; return res;

View File

@ -67,21 +67,21 @@ __catanl (__complex__ long double x)
den = 1 - r2 - __imag__ x * __imag__ x; den = 1 - r2 - __imag__ x * __imag__ x;
__real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den); __real__ res = 0.5L * __ieee754_atan2l (2.0L * __real__ x, den);
num = __imag__ x + 1.0; num = __imag__ x + 1.0L;
num = r2 + num * num; num = r2 + num * num;
den = __imag__ x - 1.0; den = __imag__ x - 1.0L;
den = r2 + den * den; den = r2 + den * den;
f = num / den; f = num / den;
if (f < 0.5) if (f < 0.5L)
__imag__ res = 0.25 * __ieee754_logl (f); __imag__ res = 0.25L * __ieee754_logl (f);
else else
{ {
num = 4.0 * __imag__ x; num = 4.0L * __imag__ x;
__imag__ res = 0.25 * __log1pl (num / den); __imag__ res = 0.25L * __log1pl (num / den);
} }
} }