summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128/s_logbl.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2012-05-25 11:57:33 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2012-05-26 13:53:22 +0200
commit25dbcb277a9dea5f241c0b888a30b9341310d941 (patch)
tree74c7933f325f44fed6f2f15fd87c59fd4752be37 /sysdeps/ieee754/ldbl-128/s_logbl.c
parentd81dcb356909937b0c8e9c69ff0be27f51aaa07a (diff)
downloadglibc-25dbcb277a9dea5f241c0b888a30b9341310d941.tar.gz
glibc-25dbcb277a9dea5f241c0b888a30b9341310d941.tar.xz
glibc-25dbcb277a9dea5f241c0b888a30b9341310d941.zip
Optimize handling of denormals in logb/logbf/logbl
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/s_logbl.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_logbl.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_logbl.c b/sysdeps/ieee754/ldbl-128/s_logbl.c
index cf6003e055..3ba67b7bd2 100644
--- a/sysdeps/ieee754/ldbl-128/s_logbl.c
+++ b/sysdeps/ieee754/ldbl-128/s_logbl.c
@@ -41,10 +41,12 @@ __logbl (long double x)
     {
       /* POSIX specifies that denormal number is treated as
          though it were normalized.  */
-      int m1 = (hx == 0) ? 0 : __builtin_clzll (hx);
-      int m2 = (lx == 0) ? 0 : __builtin_clzll (lx);
-      int ma = (m1 == 0) ? m2 + 64 : m1;
-      return -16382.0 + (long double)(15 - ma);
+      int ma;
+      if (hx == 0)
+	ma = __builtin_clzll (lx) + 64;
+      else
+	ma = __builtin_clzll (hx);
+      ex -= ma - 16;
     }
   return (long double) (ex - 16383);
 }