about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--NEWS2
-rw-r--r--math/libm-test.inc90
-rw-r--r--math/s_clog.c23
-rw-r--r--math/s_clog10.c23
-rw-r--r--math/s_clog10f.c23
-rw-r--r--math/s_clog10l.c23
-rw-r--r--math/s_clogf.c23
-rw-r--r--math/s_clogl.c23
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps132
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps152
11 files changed, 474 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index 8e6f0132f3..5291b24fe8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-07-09  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #14337]
+	* math/s_clog.c (__clog): Avoid scaling a value down where that
+	could result in underflow.
+	* math/s_clog10.c (__clog10): Likewise.
+	* math/s_clog10f.c (__clog10f): Likewise.
+	* math/s_clog10l.c (__clog10l): Likewise.
+	* math/s_clogf.c (__clogf): Likewise.
+	* math/s_clogl.c (__clogl): Likewise.
+	* math/libm-test.inc (clog_test): Add more tests.
+	(clog10_test): Likewise.
+	* sysdeps/i386/fpu/libm-test-ulps: Update.
+	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
+
 2012-07-06  Andreas Schwab  <schwab@linux-m68k.org>
 
 	[BZ #14283]
diff --git a/NEWS b/NEWS
index ab104da9d6..55ebcbdf69 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,7 @@ Version 2.17
 
 * The following bugs are resolved with this release:
 
-  6778, 14042, 14154, 14157, 14283, 14328, 14331
+  6778, 14042, 14154, 14157, 14283, 14328, 14331, 14337
 
 
 Version 2.16
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 27c53a1386..a9cc2bdca4 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -2419,6 +2419,51 @@ clog_test (void)
   TEST_c_c (clog, 0x1p-16440L, 0x1p-16441L, -11395.22807662984378194141292922726786191L, 0.4636476090008061162142562314612144020285L);
 #endif
 
+  TEST_c_c (clog, 0x1p-149L, 0x1.fp+127L, 88.69109041335841930424871526389807508374L, M_PI_2l);
+  TEST_c_c (clog, -0x1p-149L, 0x1.fp+127L, 88.69109041335841930424871526389807508374L, M_PI_2l);
+  TEST_c_c (clog, 0x1p-149L, -0x1.fp+127L, 88.69109041335841930424871526389807508374L, -M_PI_2l);
+  TEST_c_c (clog, -0x1p-149L, -0x1.fp+127L, 88.69109041335841930424871526389807508374L, -M_PI_2l);
+  TEST_c_c (clog, -0x1.fp+127L, 0x1p-149L, 88.69109041335841930424871526389807508374L, M_PIl);
+  TEST_c_c (clog, -0x1.fp+127L, -0x1p-149L, 88.69109041335841930424871526389807508374L, -M_PIl);
+#ifdef TEST_FLOAT
+  TEST_c_c (clog, 0x1.fp+127L, 0x1p-149L, 88.69109041335841930424871526389807508374L, plus_zero, UNDERFLOW_EXCEPTION);
+  TEST_c_c (clog, 0x1.fp+127L, -0x1p-149L, 88.69109041335841930424871526389807508374L, minus_zero, UNDERFLOW_EXCEPTION);
+#endif
+
+#ifndef TEST_FLOAT
+  TEST_c_c (clog, 0x1p-1074L, 0x1.fp+1023L, 709.7509641950694165420886960904242800794L, M_PI_2l);
+  TEST_c_c (clog, -0x1p-1074L, 0x1.fp+1023L, 709.7509641950694165420886960904242800794L, M_PI_2l);
+  TEST_c_c (clog, 0x1p-1074L, -0x1.fp+1023L, 709.7509641950694165420886960904242800794L, -M_PI_2l);
+  TEST_c_c (clog, -0x1p-1074L, -0x1.fp+1023L, 709.7509641950694165420886960904242800794L, -M_PI_2l);
+  TEST_c_c (clog, -0x1.fp+1023L, 0x1p-1074L, 709.7509641950694165420886960904242800794L, M_PIl);
+  TEST_c_c (clog, -0x1.fp+1023L, -0x1p-1074L, 709.7509641950694165420886960904242800794L, -M_PIl);
+#endif
+#if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MAX_EXP == 1024)
+  TEST_c_c (clog, 0x1.fp+1023L, 0x1p-1074L, 709.7509641950694165420886960904242800794L, plus_zero, UNDERFLOW_EXCEPTION);
+  TEST_c_c (clog, 0x1.fp+1023L, -0x1p-1074L, 709.7509641950694165420886960904242800794L, minus_zero, UNDERFLOW_EXCEPTION);
+#endif
+
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+  TEST_c_c (clog, 0x1p-16445L, 0x1.fp+16383L, 11356.49165759582936919077408168801636572L, M_PI_2l);
+  TEST_c_c (clog, -0x1p-16445L, 0x1.fp+16383L, 11356.49165759582936919077408168801636572L, M_PI_2l);
+  TEST_c_c (clog, 0x1p-16445L, -0x1.fp+16383L, 11356.49165759582936919077408168801636572L, -M_PI_2l);
+  TEST_c_c (clog, -0x1p-16445L, -0x1.fp+16383L, 11356.49165759582936919077408168801636572L, -M_PI_2l);
+  TEST_c_c (clog, -0x1.fp+16383L, 0x1p-16445L, 11356.49165759582936919077408168801636572L, M_PIl);
+  TEST_c_c (clog, -0x1.fp+16383L, -0x1p-16445L, 11356.49165759582936919077408168801636572L, -M_PIl);
+  TEST_c_c (clog, 0x1.fp+16383L, 0x1p-16445L, 11356.49165759582936919077408168801636572L, plus_zero, UNDERFLOW_EXCEPTION);
+  TEST_c_c (clog, 0x1.fp+16383L, -0x1p-16445L, 11356.49165759582936919077408168801636572L, minus_zero, UNDERFLOW_EXCEPTION);
+# if LDBL_MANT_DIG >= 113
+  TEST_c_c (clog, 0x1p-16494L, 0x1.fp+16383L, 11356.49165759582936919077408168801636572L, M_PI_2l);
+  TEST_c_c (clog, -0x1p-16494L, 0x1.fp+16383L, 11356.49165759582936919077408168801636572L, M_PI_2l);
+  TEST_c_c (clog, 0x1p-16494L, -0x1.fp+16383L, 11356.49165759582936919077408168801636572L, -M_PI_2l);
+  TEST_c_c (clog, -0x1p-16494L, -0x1.fp+16383L, 11356.49165759582936919077408168801636572L, -M_PI_2l);
+  TEST_c_c (clog, -0x1.fp+16383L, 0x1p-16494L, 11356.49165759582936919077408168801636572L, M_PIl);
+  TEST_c_c (clog, -0x1.fp+16383L, -0x1p-16494L, 11356.49165759582936919077408168801636572L, -M_PIl);
+  TEST_c_c (clog, 0x1.fp+16383L, 0x1p-16494L, 11356.49165759582936919077408168801636572L, plus_zero, UNDERFLOW_EXCEPTION);
+  TEST_c_c (clog, 0x1.fp+16383L, -0x1p-16494L, 11356.49165759582936919077408168801636572L, minus_zero, UNDERFLOW_EXCEPTION);
+# endif
+#endif
+
   END (clog, complex);
 }
 
@@ -2503,6 +2548,51 @@ clog10_test (void)
   TEST_c_c (clog10, 0x1p-16440L, 0x1p-16441L, -4948.884673709346821106688037612752099609L, 0.2013595981366865710389502301937289472543L);
 #endif
 
+  TEST_c_c (clog10, 0x1p-149L, 0x1.fp+127L, 38.51805116050395969095658815123105801479L, 0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1p-149L, 0x1.fp+127L, 38.51805116050395969095658815123105801479L, 0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, 0x1p-149L, -0x1.fp+127L, 38.51805116050395969095658815123105801479L, -0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1p-149L, -0x1.fp+127L, 38.51805116050395969095658815123105801479L, -0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1.fp+127L, 0x1p-149L, 38.51805116050395969095658815123105801479L, 1.364376353841841347485783625431355770210L);
+  TEST_c_c (clog10, -0x1.fp+127L, -0x1p-149L, 38.51805116050395969095658815123105801479L, -1.364376353841841347485783625431355770210L);
+#ifdef TEST_FLOAT
+  TEST_c_c (clog10, 0x1.fp+127L, 0x1p-149L, 38.51805116050395969095658815123105801479L, plus_zero, UNDERFLOW_EXCEPTION);
+  TEST_c_c (clog10, 0x1.fp+127L, -0x1p-149L, 38.51805116050395969095658815123105801479L, minus_zero, UNDERFLOW_EXCEPTION);
+#endif
+
+#ifndef TEST_FLOAT
+  TEST_c_c (clog10, 0x1p-1074L, 0x1.fp+1023L, 308.2409272754311106024666378243768099991L, 0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1p-1074L, 0x1.fp+1023L, 308.2409272754311106024666378243768099991L, 0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, 0x1p-1074L, -0x1.fp+1023L, 308.2409272754311106024666378243768099991L, -0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1p-1074L, -0x1.fp+1023L, 308.2409272754311106024666378243768099991L, -0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1.fp+1023L, 0x1p-1074L, 308.2409272754311106024666378243768099991L, 1.364376353841841347485783625431355770210L);
+  TEST_c_c (clog10, -0x1.fp+1023L, -0x1p-1074L, 308.2409272754311106024666378243768099991L, -1.364376353841841347485783625431355770210L);
+#endif
+#if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MAX_EXP == 1024)
+  TEST_c_c (clog10, 0x1.fp+1023L, 0x1p-1074L, 308.2409272754311106024666378243768099991L, plus_zero, UNDERFLOW_EXCEPTION);
+  TEST_c_c (clog10, 0x1.fp+1023L, -0x1p-1074L, 308.2409272754311106024666378243768099991L, minus_zero, UNDERFLOW_EXCEPTION);
+#endif
+
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+  TEST_c_c (clog10, 0x1p-16445L, 0x1.fp+16383L, 4932.061660674182269085496060792589701158L, 0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1p-16445L, 0x1.fp+16383L, 4932.061660674182269085496060792589701158L, 0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, 0x1p-16445L, -0x1.fp+16383L, 4932.061660674182269085496060792589701158L, -0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1p-16445L, -0x1.fp+16383L, 4932.061660674182269085496060792589701158L, -0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1.fp+16383L, 0x1p-16445L, 4932.061660674182269085496060792589701158L, 1.364376353841841347485783625431355770210L);
+  TEST_c_c (clog10, -0x1.fp+16383L, -0x1p-16445L, 4932.061660674182269085496060792589701158L, -1.364376353841841347485783625431355770210L);
+  TEST_c_c (clog10, 0x1.fp+16383L, 0x1p-16445L, 4932.061660674182269085496060792589701158L, plus_zero, UNDERFLOW_EXCEPTION);
+  TEST_c_c (clog10, 0x1.fp+16383L, -0x1p-16445L, 4932.061660674182269085496060792589701158L, minus_zero, UNDERFLOW_EXCEPTION);
+# if LDBL_MANT_DIG >= 113
+  TEST_c_c (clog10, 0x1p-16494L, 0x1.fp+16383L, 4932.061660674182269085496060792589701158L, 0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1p-16494L, 0x1.fp+16383L, 4932.061660674182269085496060792589701158L, 0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, 0x1p-16494L, -0x1.fp+16383L, 4932.061660674182269085496060792589701158L, -0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1p-16494L, -0x1.fp+16383L, 4932.061660674182269085496060792589701158L, -0.6821881769209206737428918127156778851051L);
+  TEST_c_c (clog10, -0x1.fp+16383L, 0x1p-16494L, 4932.061660674182269085496060792589701158L, 1.364376353841841347485783625431355770210L);
+  TEST_c_c (clog10, -0x1.fp+16383L, -0x1p-16494L, 4932.061660674182269085496060792589701158L, -1.364376353841841347485783625431355770210L);
+  TEST_c_c (clog10, 0x1.fp+16383L, 0x1p-16494L, 4932.061660674182269085496060792589701158L, plus_zero, UNDERFLOW_EXCEPTION);
+  TEST_c_c (clog10, 0x1.fp+16383L, -0x1p-16494L, 4932.061660674182269085496060792589701158L, minus_zero, UNDERFLOW_EXCEPTION);
+# endif
+#endif
+
   END (clog10, complex);
 }
 
diff --git a/math/s_clog.c b/math/s_clog.c
index 15e5e9c678..2249e86b43 100644
--- a/math/s_clog.c
+++ b/math/s_clog.c
@@ -40,25 +40,30 @@ __clog (__complex__ double x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
+      double absx = fabs (__real__ x), absy = fabs (__imag__ x);
       double d;
       int scale = 0;
 
-      if (fabs (__real__ x) > DBL_MAX / 2.0
-	  || fabs (__imag__ x) > DBL_MAX / 2.0)
+      if (absx > DBL_MAX / 2.0)
 	{
 	  scale = -1;
-	  __real__ x = __scalbn (__real__ x, scale);
-	  __imag__ x = __scalbn (__imag__ x, scale);
+	  absx = __scalbn (absx, scale);
+	  absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0);
 	}
-      else if (fabs (__real__ x) < DBL_MIN
-	       && fabs (__imag__ x) < DBL_MIN)
+      else if (absy > DBL_MAX / 2.0)
+	{
+	  scale = -1;
+	  absx = (absx >= DBL_MIN * 2.0 ? __scalbn (absx, scale) : 0.0);
+	  absy = __scalbn (absy, scale);
+	}
+      else if (absx < DBL_MIN && absy < DBL_MIN)
 	{
 	  scale = DBL_MANT_DIG;
-	  __real__ x = __scalbn (__real__ x, scale);
-	  __imag__ x = __scalbn (__imag__ x, scale);
+	  absx = __scalbn (absx, scale);
+	  absy = __scalbn (absy, scale);
 	}
 
-      d = __ieee754_hypot (__real__ x, __imag__ x);
+      d = __ieee754_hypot (absx, absy);
 
       __real__ result = __ieee754_log (d) - scale * M_LN2;
       __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
diff --git a/math/s_clog10.c b/math/s_clog10.c
index 9d366d6f2b..cf5fb8a0b5 100644
--- a/math/s_clog10.c
+++ b/math/s_clog10.c
@@ -43,25 +43,30 @@ __clog10 (__complex__ double x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
+      double absx = fabs (__real__ x), absy = fabs (__imag__ x);
       double d;
       int scale = 0;
 
-      if (fabs (__real__ x) > DBL_MAX / 2.0
-	  || fabs (__imag__ x) > DBL_MAX / 2.0)
+      if (absx > DBL_MAX / 2.0)
 	{
 	  scale = -1;
-	  __real__ x = __scalbn (__real__ x, scale);
-	  __imag__ x = __scalbn (__imag__ x, scale);
+	  absx = __scalbn (absx, scale);
+	  absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0);
 	}
-      else if (fabs (__real__ x) < DBL_MIN
-	       && fabs (__imag__ x) < DBL_MIN)
+      else if (absy > DBL_MAX / 2.0)
+	{
+	  scale = -1;
+	  absx = (absx >= DBL_MIN * 2.0 ? __scalbn (absx, scale) : 0.0);
+	  absy = __scalbn (absy, scale);
+	}
+      else if (absx < DBL_MIN && absy < DBL_MIN)
 	{
 	  scale = DBL_MANT_DIG;
-	  __real__ x = __scalbn (__real__ x, scale);
-	  __imag__ x = __scalbn (__imag__ x, scale);
+	  absx = __scalbn (absx, scale);
+	  absy = __scalbn (absy, scale);
 	}
 
-      d = __ieee754_hypot (__real__ x, __imag__ x);
+      d = __ieee754_hypot (absx, absy);
 
       __real__ result = __ieee754_log10 (d) - scale * M_LOG10_2;
       __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
diff --git a/math/s_clog10f.c b/math/s_clog10f.c
index 11bb0bb9ad..5a0c370de5 100644
--- a/math/s_clog10f.c
+++ b/math/s_clog10f.c
@@ -43,25 +43,30 @@ __clog10f (__complex__ float x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
+      float absx = fabsf (__real__ x), absy = fabsf (__imag__ x);
       float d;
       int scale = 0;
 
-      if (fabsf (__real__ x) > FLT_MAX / 2.0f
-	  || fabsf (__imag__ x) > FLT_MAX / 2.0f)
+      if (absx > FLT_MAX / 2.0f)
 	{
 	  scale = -1;
-	  __real__ x = __scalbnf (__real__ x, scale);
-	  __imag__ x = __scalbnf (__imag__ x, scale);
+	  absx = __scalbnf (absx, scale);
+	  absy = (absy >= FLT_MIN * 2.0f ? __scalbnf (absy, scale) : 0.0f);
 	}
-      else if (fabsf (__real__ x) < FLT_MIN
-	       && fabsf (__imag__ x) < FLT_MIN)
+      else if (absy > FLT_MAX / 2.0f)
+	{
+	  scale = -1;
+	  absx = (absx >= FLT_MIN * 2.0f ? __scalbnf (absx, scale) : 0.0f);
+	  absy = __scalbnf (absy, scale);
+	}
+      else if (absx < FLT_MIN && absy < FLT_MIN)
 	{
 	  scale = FLT_MANT_DIG;
-	  __real__ x = __scalbnf (__real__ x, scale);
-	  __imag__ x = __scalbnf (__imag__ x, scale);
+	  absx = __scalbnf (absx, scale);
+	  absy = __scalbnf (absy, scale);
 	}
 
-      d = __ieee754_hypotf (__real__ x, __imag__ x);
+      d = __ieee754_hypotf (absx, absy);
 
       __real__ result = __ieee754_log10f (d) - scale * M_LOG10_2f;
       __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x);
diff --git a/math/s_clog10l.c b/math/s_clog10l.c
index d1fc872cba..3e0ceaa2a8 100644
--- a/math/s_clog10l.c
+++ b/math/s_clog10l.c
@@ -43,25 +43,30 @@ __clog10l (__complex__ long double x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
+      long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x);
       long double d;
       int scale = 0;
 
-      if (fabsl (__real__ x) > LDBL_MAX / 2.0L
-	  || fabsl (__imag__ x) > LDBL_MAX / 2.0L)
+      if (absx > LDBL_MAX / 2.0L)
 	{
 	  scale = -1;
-	  __real__ x = __scalbnl (__real__ x, scale);
-	  __imag__ x = __scalbnl (__imag__ x, scale);
+	  absx = __scalbnl (absx, scale);
+	  absy = (absy >= LDBL_MIN * 2.0L ? __scalbnl (absy, scale) : 0.0L);
 	}
-      else if (fabsl (__real__ x) < LDBL_MIN
-	       && fabsl (__imag__ x) < LDBL_MIN)
+      else if (absy > LDBL_MAX / 2.0L)
+	{
+	  scale = -1;
+	  absx = (absx >= LDBL_MIN * 2.0L ? __scalbnl (absx, scale) : 0.0L);
+	  absy = __scalbnl (absy, scale);
+	}
+      else if (absx < LDBL_MIN && absy < LDBL_MIN)
 	{
 	  scale = LDBL_MANT_DIG;
-	  __real__ x = __scalbnl (__real__ x, scale);
-	  __imag__ x = __scalbnl (__imag__ x, scale);
+	  absx = __scalbnl (absx, scale);
+	  absy = __scalbnl (absy, scale);
 	}
 
-      d = __ieee754_hypotl (__real__ x, __imag__ x);
+      d = __ieee754_hypotl (absx, absy);
 
       __real__ result = __ieee754_log10l (d) - scale * M_LOG10_2l;
       __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x);
diff --git a/math/s_clogf.c b/math/s_clogf.c
index 0b27506fb4..e20e594964 100644
--- a/math/s_clogf.c
+++ b/math/s_clogf.c
@@ -40,25 +40,30 @@ __clogf (__complex__ float x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
+      float absx = fabsf (__real__ x), absy = fabsf (__imag__ x);
       float d;
       int scale = 0;
 
-      if (fabsf (__real__ x) > FLT_MAX / 2.0f
-	  || fabsf (__imag__ x) > FLT_MAX / 2.0f)
+      if (absx > FLT_MAX / 2.0f)
 	{
 	  scale = -1;
-	  __real__ x = __scalbnf (__real__ x, scale);
-	  __imag__ x = __scalbnf (__imag__ x, scale);
+	  absx = __scalbnf (absx, scale);
+	  absy = (absy >= FLT_MIN * 2.0f ? __scalbnf (absy, scale) : 0.0f);
 	}
-      else if (fabsf (__real__ x) < FLT_MIN
-	       && fabsf (__imag__ x) < FLT_MIN)
+      else if (absy > FLT_MAX / 2.0f)
+	{
+	  scale = -1;
+	  absx = (absx >= FLT_MIN * 2.0f ? __scalbnf (absx, scale) : 0.0f);
+	  absy = __scalbnf (absy, scale);
+	}
+      else if (absx < FLT_MIN && absy < FLT_MIN)
 	{
 	  scale = FLT_MANT_DIG;
-	  __real__ x = __scalbnf (__real__ x, scale);
-	  __imag__ x = __scalbnf (__imag__ x, scale);
+	  absx = __scalbnf (absx, scale);
+	  absy = __scalbnf (absy, scale);
 	}
 
-      d = __ieee754_hypotf (__real__ x, __imag__ x);
+      d = __ieee754_hypotf (absx, absy);
 
       __real__ result = __ieee754_logf (d) - scale * (float) M_LN2;
       __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
diff --git a/math/s_clogl.c b/math/s_clogl.c
index 8968eefee3..a393b88a5f 100644
--- a/math/s_clogl.c
+++ b/math/s_clogl.c
@@ -40,25 +40,30 @@ __clogl (__complex__ long double x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
+      long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x);
       long double d;
       int scale = 0;
 
-      if (fabsl (__real__ x) > LDBL_MAX / 2.0L
-	  || fabsl (__imag__ x) > LDBL_MAX / 2.0L)
+      if (absx > LDBL_MAX / 2.0L)
 	{
 	  scale = -1;
-	  __real__ x = __scalbnl (__real__ x, scale);
-	  __imag__ x = __scalbnl (__imag__ x, scale);
+	  absx = __scalbnl (absx, scale);
+	  absy = (absy >= LDBL_MIN * 2.0L ? __scalbnl (absy, scale) : 0.0L);
 	}
-      else if (fabsl (__real__ x) < LDBL_MIN
-	       && fabsl (__imag__ x) < LDBL_MIN)
+      else if (absy > LDBL_MAX / 2.0L)
+	{
+	  scale = -1;
+	  absx = (absx >= LDBL_MIN * 2.0L ? __scalbnl (absx, scale) : 0.0L);
+	  absy = __scalbnl (absy, scale);
+	}
+      else if (absx < LDBL_MIN && absy < LDBL_MIN)
 	{
 	  scale = LDBL_MANT_DIG;
-	  __real__ x = __scalbnl (__real__ x, scale);
-	  __imag__ x = __scalbnl (__imag__ x, scale);
+	  absx = __scalbnl (absx, scale);
+	  absy = __scalbnl (absy, scale);
 	}
 
-      d = __ieee754_hypotl (__real__ x, __imag__ x);
+      d = __ieee754_hypotl (absx, absy);
 
       __real__ result = __ieee754_logl (d) - scale * M_LN2l;
       __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 9ea5ed6fbb..2649d11476 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -789,6 +789,30 @@ ildouble: 1
 ldouble: 1
 
 # clog
+Test "Real part of: clog (-0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1.fp+127 - 0x1p-149 i) == 88.69109041335841930424871526389807508374 - pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1.fp+16383 + 0x1p-16445 i) == 11356.49165759582936919077408168801636572 + pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1.fp+16383 - 0x1p-16445 i) == 11356.49165759582936919077408168801636572 - pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-16445 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-16445 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
 float: 1
 ifloat: 1
@@ -803,12 +827,30 @@ ldouble: 1
 Test "Real part of: clog (0x1.fp+16383 + 0x1p+16383 i) == 11356.60974243783798653123798337822335902 + 0.4764674194737066993385333770295162295856 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 + 0x1p-16445 i) == 11356.49165759582936919077408168801636572 + +0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 - 0x1p-16445 i) == 11356.49165759582936919077408168801636572 - 0 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog (0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: clog (0x1p-149 + 0x1p-149 i) == -102.9323563131518784484589700365392203592 + pi/4 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-16445 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-16445 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
+ildouble: 1
+ldouble: 1
 
 # clog10
 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
@@ -821,6 +863,62 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (-0x1.fp+1023 + 0x1p-1074 i) == 308.2409272754311106024666378243768099991 + 1.364376353841841347485783625431355770210 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1.fp+1023 - 0x1p-1074 i) == 308.2409272754311106024666378243768099991 - 1.364376353841841347485783625431355770210 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (-0x1.fp+127 + 0x1p-149 i) == 38.51805116050395969095658815123105801479 + 1.364376353841841347485783625431355770210 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1.fp+127 + 0x1p-149 i) == 38.51805116050395969095658815123105801479 + 1.364376353841841347485783625431355770210 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (-0x1.fp+127 - 0x1p-149 i) == 38.51805116050395969095658815123105801479 - 1.364376353841841347485783625431355770210 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1.fp+127 - 0x1p-149 i) == 38.51805116050395969095658815123105801479 - 1.364376353841841347485783625431355770210 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (-0x1.fp+16383 + 0x1p-16445 i) == 4932.061660674182269085496060792589701158 + 1.364376353841841347485783625431355770210 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (-0x1.fp+16383 - 0x1p-16445 i) == 4932.061660674182269085496060792589701158 - 1.364376353841841347485783625431355770210 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (-0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (-0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (-0x1p-16445 + 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 + 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (-0x1p-16445 - 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 - 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
 double: 1
 idouble: 1
@@ -896,17 +994,37 @@ ldouble: 1
 Test "Real part of: clog10 (0x1.fp+16383 + 0x1p+16383 i) == 4932.112944269463028900262609694408579449 + 0.2069271710841128115912940666587802677383 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog10 (0x1.fp+16383 + 0x1p-16445 i) == 4932.061660674182269085496060792589701158 + +0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1.fp+16383 - 0x1p-16445 i) == 4932.061660674182269085496060792589701158 - 0 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i":
 double: 1
 idouble: 1
+Test "Imaginary part of: clog10 (0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
 Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i":
 double: 1
 idouble: 1
+Test "Imaginary part of: clog10 (0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
 Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i) == -44.10089436477324509881274807713822842154 + pi/4*log10(e) i":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Real part of: clog10 (0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
 Test "Real part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i":
 ildouble: 1
 ldouble: 1
@@ -915,12 +1033,26 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Real part of: clog10 (0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
 Test "Real part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
 ildouble: 1
 ldouble: 1
 Test "Imaginary part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog10 (0x1p-16445 + 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 + 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1p-16445 - 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 - 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
 double: 1
 float: 1
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index be28024b51..7f94a7c96e 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -729,6 +729,44 @@ ildouble: 1
 ldouble: 1
 
 # clog
+Test "Real part of: clog (-0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + pi i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1.fp+127 - 0x1p-149 i) == 88.69109041335841930424871526389807508374 - pi i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1.fp+16383 + 0x1p-16445 i) == 11356.49165759582936919077408168801636572 + pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1.fp+16383 - 0x1p-16445 i) == 11356.49165759582936919077408168801636572 - pi i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (-0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (-0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (-0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (-0x1p-16445 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (-0x1p-16445 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
 float: 3
 ifloat: 3
@@ -740,12 +778,24 @@ ldouble: 1
 Test "Real part of: clog (0x1.fffffep+127 + 0x1.fffffep+127 i) == 89.06941264234832570836679262104313101776 + pi/4 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog (0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + +0 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (0x1.fp+127 - 0x1p-149 i) == 88.69109041335841930424871526389807508374 - 0 i":
+float: 1
+ifloat: 1
 Test "Real part of: clog (0x1.fp+16383 + 0x1.fp+16383 i) == 11356.83823118610934184548269774874545400 + pi/4 i":
 ildouble: 1
 ldouble: 1
 Test "Real part of: clog (0x1.fp+16383 + 0x1p+16383 i) == 11356.60974243783798653123798337822335902 + 0.4764674194737066993385333770295162295856 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 + 0x1p-16445 i) == 11356.49165759582936919077408168801636572 + +0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 - 0x1p-16445 i) == 11356.49165759582936919077408168801636572 - 0 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i":
 double: 1
 idouble: 1
@@ -754,9 +804,25 @@ ldouble: 1
 Test "Real part of: clog (0x1p-147 + 0x1p-147 i) == -101.5460619520319878296245057936228672231 + pi/4 i":
 float: 1
 ifloat: 1
+Test "Real part of: clog (0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: clog (0x1p-149 + 0x1p-149 i) == -102.9323563131518784484589700365392203592 + pi/4 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-16445 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-16445 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
+ildouble: 1
+ldouble: 1
 
 # clog10
 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
@@ -769,6 +835,58 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (-0x1.fp+1023 + 0x1p-1074 i) == 308.2409272754311106024666378243768099991 + 1.364376353841841347485783625431355770210 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1.fp+1023 - 0x1p-1074 i) == 308.2409272754311106024666378243768099991 - 1.364376353841841347485783625431355770210 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (-0x1.fp+127 + 0x1p-149 i) == 38.51805116050395969095658815123105801479 + 1.364376353841841347485783625431355770210 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1.fp+127 + 0x1p-149 i) == 38.51805116050395969095658815123105801479 + 1.364376353841841347485783625431355770210 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (-0x1.fp+127 - 0x1p-149 i) == 38.51805116050395969095658815123105801479 - 1.364376353841841347485783625431355770210 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1.fp+127 - 0x1p-149 i) == 38.51805116050395969095658815123105801479 - 1.364376353841841347485783625431355770210 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (-0x1.fp+16383 + 0x1p-16445 i) == 4932.061660674182269085496060792589701158 + 1.364376353841841347485783625431355770210 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (-0x1.fp+16383 - 0x1p-16445 i) == 4932.061660674182269085496060792589701158 - 1.364376353841841347485783625431355770210 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (-0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (-0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (-0x1p-16445 + 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 + 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (-0x1p-16445 - 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 - 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
 double: 1
 float: 5
@@ -849,20 +967,40 @@ ldouble: 1
 Test "Real part of: clog10 (0x1.fp+16383 + 0x1p+16383 i) == 4932.112944269463028900262609694408579449 + 0.2069271710841128115912940666587802677383 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog10 (0x1.fp+16383 + 0x1p-16445 i) == 4932.061660674182269085496060792589701158 + +0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1.fp+16383 - 0x1p-16445 i) == 4932.061660674182269085496060792589701158 - 0 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i":
 double: 1
 idouble: 1
+Test "Imaginary part of: clog10 (0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
 Test "Real part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i":
 double: 1
 idouble: 1
 Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i":
 double: 1
 idouble: 1
+Test "Imaginary part of: clog10 (0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+idouble: 1
 Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i) == -44.10089436477324509881274807713822842154 + pi/4*log10(e) i":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Real part of: clog10 (0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
 Test "Real part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i":
 ildouble: 1
 ldouble: 1
@@ -871,12 +1009,26 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Real part of: clog10 (0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
 Test "Real part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
 ildouble: 1
 ldouble: 1
 Test "Imaginary part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog10 (0x1p-16445 + 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 + 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1p-16445 - 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 - 0.6821881769209206737428918127156778851051 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
 double: 1
 float: 1