about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/e_log10.c
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2021-01-07 15:26:26 +0000
committerWilco Dijkstra <wdijkstr@arm.com>2021-01-07 15:26:26 +0000
commit9e97f239eae1f2b1d2e694d844c0f6fd7c4dd271 (patch)
treea9a2828381bf838da12fa738da4f1bda4bee161c /sysdeps/ieee754/dbl-64/e_log10.c
parentcaa884dda78ff226243f8cb344915152052a5118 (diff)
downloadglibc-9e97f239eae1f2b1d2e694d844c0f6fd7c4dd271.tar.gz
glibc-9e97f239eae1f2b1d2e694d844c0f6fd7c4dd271.tar.xz
glibc-9e97f239eae1f2b1d2e694d844c0f6fd7c4dd271.zip
Remove dbl-64/wordsize-64 (part 2)
Remove the wordsize-64 implementations by merging them into the main dbl-64
directory.  The second patch just moves all wordsize-64 files and removes a
few wordsize-64 uses in comments and Implies files.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_log10.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_log10.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_log10.c b/sysdeps/ieee754/dbl-64/e_log10.c
index 44a4bd2faa..b89064fb7c 100644
--- a/sysdeps/ieee754/dbl-64/e_log10.c
+++ b/sysdeps/ieee754/dbl-64/e_log10.c
@@ -44,44 +44,46 @@
  */
 
 #include <math.h>
-#include <math_private.h>
 #include <fix-int-fp-convert-zero.h>
+#include <math_private.h>
+#include <stdint.h>
 #include <libm-alias-finite.h>
 
-static const double two54 = 1.80143985094819840000e+16;         /* 0x43500000, 0x00000000 */
-static const double ivln10 = 4.34294481903251816668e-01;        /* 0x3FDBCB7B, 0x1526E50E */
-static const double log10_2hi = 3.01029995663611771306e-01;     /* 0x3FD34413, 0x509F6000 */
-static const double log10_2lo = 3.69423907715893078616e-13;     /* 0x3D59FEF3, 0x11F12B36 */
+static const double two54 = 1.80143985094819840000e+16;		/* 0x4350000000000000 */
+static const double ivln10 = 4.34294481903251816668e-01;	/* 0x3FDBCB7B1526E50E */
+static const double log10_2hi = 3.01029995663611771306e-01;	/* 0x3FD34413509F6000 */
+static const double log10_2lo = 3.69423907715893078616e-13;	/* 0x3D59FEF311F12B36 */
 
 double
 __ieee754_log10 (double x)
 {
   double y, z;
-  int32_t i, k, hx;
-  uint32_t lx;
+  int64_t i, hx;
+  int32_t k;
 
-  EXTRACT_WORDS (hx, lx, x);
+  EXTRACT_WORDS64 (hx, x);
 
   k = 0;
-  if (hx < 0x00100000)
-    {                           /* x < 2**-1022  */
-      if (__glibc_unlikely (((hx & 0x7fffffff) | lx) == 0))
-	return -two54 / fabs (x);	/* log(+-0)=-inf  */
+  if (hx < INT64_C(0x0010000000000000))
+    {				/* x < 2**-1022  */
+      if (__glibc_unlikely ((hx & UINT64_C(0x7fffffffffffffff)) == 0))
+	return -two54 / fabs (x);	/* log(+-0)=-inf */
       if (__glibc_unlikely (hx < 0))
-	return (x - x) / (x - x);       /* log(-#) = NaN */
+	return (x - x) / (x - x);	/* log(-#) = NaN */
       k -= 54;
-      x *= two54;               /* subnormal number, scale up x */
-      GET_HIGH_WORD (hx, x);
+      x *= two54;		/* subnormal number, scale up x */
+      EXTRACT_WORDS64 (hx, x);
     }
-  if (__glibc_unlikely (hx >= 0x7ff00000))
+  /* scale up resulted in a NaN number  */
+  if (__glibc_unlikely (hx >= UINT64_C(0x7ff0000000000000)))
     return x + x;
-  k += (hx >> 20) - 1023;
-  i = ((uint32_t) k & 0x80000000) >> 31;
-  hx = (hx & 0x000fffff) | ((0x3ff - i) << 20);
+  k += (hx >> 52) - 1023;
+  i = ((uint64_t) k & UINT64_C(0x8000000000000000)) >> 63;
+  hx = (hx & UINT64_C(0x000fffffffffffff)) | ((0x3ff - i) << 52);
   y = (double) (k + i);
   if (FIX_INT_FP_CONVERT_ZERO && y == 0.0)
     y = 0.0;
-  SET_HIGH_WORD (x, hx);
+  INSERT_WORDS64 (x, hx);
   z = y * log10_2lo + ivln10 * __ieee754_log (x);
   return z + y * log10_2hi;
 }