aboutsummaryrefslogtreecommitdiff
path: root/math/s_clogl.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-07-31 14:21:19 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-07-31 14:21:19 +0000
commitd0419dbfbd19cb01398d43895a679c0bcb961070 (patch)
treed600a45e750c40eed4d2050bd2b3bba3c9e64309 /math/s_clogl.c
parent2bc1387273d2123398fc12133643ea2bc02a2cd1 (diff)
downloadglibc-d0419dbfbd19cb01398d43895a679c0bcb961070.zip
glibc-d0419dbfbd19cb01398d43895a679c0bcb961070.tar.gz
glibc-d0419dbfbd19cb01398d43895a679c0bcb961070.tar.bz2
Improve clog, clog10 handling of values with real or imaginary part slightly above 1 (bug 13629).
Diffstat (limited to 'math/s_clogl.c')
-rw-r--r--math/s_clogl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/math/s_clogl.c b/math/s_clogl.c
index d98a3c0..eaba572 100644
--- a/math/s_clogl.c
+++ b/math/s_clogl.c
@@ -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
+
__complex__ long double
__clogl (__complex__ long double x)
{
@@ -71,6 +78,13 @@ __clogl (__complex__ long double x)
else
__real__ result = __log1pl (absy2) / 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) / 2.0L;
+ }
else
{
long double d = __ieee754_hypotl (absx, absy);