1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

Improve clog, clog10 handling of values with real or imaginary part slightly above 1 (bug 13629).

This commit is contained in:
Joseph Myers
2012-07-31 14:21:19 +00:00
parent 2bc1387273
commit d0419dbfbd
10 changed files with 258 additions and 2 deletions

View File

@@ -22,6 +22,13 @@
#include <math_private.h>
#include <float.h>
/* To avoid spurious underflows, use this definition to treat IBM long
double as approximating an IEEE-style format. */
#if LDBL_MANT_DIG == 106
# undef LDBL_EPSILON
# define LDBL_EPSILON 0x1p-106L
#endif
/* log_10 (2). */
#define M_LOG10_2l 0.3010299956639811952137388947244930267682L
@@ -75,6 +82,13 @@ __clog10l (__complex__ long double x)
else
__real__ result = __log1pl (absy2) * (M_LOG10El / 2.0L);
}
else if (absx > 1.0L && absx < 2.0L && absy < 1.0L && scale == 0)
{
long double d2m1 = (absx - 1.0L) * (absx + 1.0L);
if (absy >= LDBL_EPSILON)
d2m1 += absy * absy;
__real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L);
}
else
{
long double d = __ieee754_hypotl (absx, absy);