Makefile.am (libquadmath_la_SOURCES): Add math/logbq.c.
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sun, 9 Aug 2015 08:46:52 +0000 (08:46 +0000)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sun, 9 Aug 2015 08:46:52 +0000 (08:46 +0000)
* Makefile.am (libquadmath_la_SOURCES): Add math/logbq.c.
* Makefile.in: Regenerate.
* libquadmath.texi: Document logbq.
* quadmath.h: Add logbq prototype.
* quadmath.map: Add logbq.
* quadmath_weak.h: Add logbq prototype.
* math/logbq.c: New file

From-SVN: r226748

libquadmath/ChangeLog
libquadmath/Makefile.am
libquadmath/Makefile.in
libquadmath/libquadmath.texi
libquadmath/math/logbq.c [new file with mode: 0644]
libquadmath/quadmath.h
libquadmath/quadmath.map
libquadmath/quadmath_weak.h

index 2eee6f286c15c0edc8bc79019bc6837478848010..a47355aa236bfa4fecfedab6ca550f3c07d7d97a 100644 (file)
@@ -1,3 +1,13 @@
+2015-08-09  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       * Makefile.am (libquadmath_la_SOURCES): Add math/logbq.c.
+       * Makefile.in: Regenerate.
+       * libquadmath.texi: Document logbq.
+       * quadmath.h: Add logbq prototype.
+       * quadmath.map: Add logbq.
+       * quadmath_weak.h: Add logbq prototype.
+       * math/logbq.c: New file
+
 2015-05-13  Michael Haubenwallner  <michael.haubenwallner@ssi-schaefer.com>
 
        * Makefile.in: Regenerated with automake-1.11.6.
index 145fb38fc2471b4a44c37a7eca926227455e9e3f..5c4d3e2ece1e9825c82952c71b8d8e082dd05617 100644 (file)
@@ -57,7 +57,7 @@ libquadmath_la_SOURCES = \
   math/erfq.c math/logq.c math/sqrtq.c math/expm1q.c math/lroundq.c \
   math/tanhq.c math/expq.c math/modfq.c math/tanq.c math/fabsq.c \
   math/nanq.c math/tgammaq.c math/finiteq.c math/nextafterq.c \
-  math/truncq.c math/floorq.c math/powq.c math/fmaq.c \
+  math/truncq.c math/floorq.c math/powq.c math/fmaq.c math/logbq.c \
   math/cacoshq.c math/cacosq.c math/casinhq.c math/casinq.c \
   math/catanhq.c math/catanq.c math/cimagq.c math/conjq.c math/cprojq.c \
   math/crealq.c math/fdimq.c math/fmaxq.c math/fminq.c math/ilogbq.c \
index aad6b71bf9c01c80dca4e98fa5fadacc6793e7ea..94e8014d175a5d5801c83e33cc6f824b7f2c027d 100644 (file)
@@ -140,23 +140,24 @@ am__dirstamp = $(am__leading_dot)dirstamp
 @BUILD_LIBQUADMATH_TRUE@       math/tgammaq.lo math/finiteq.lo \
 @BUILD_LIBQUADMATH_TRUE@       math/nextafterq.lo math/truncq.lo \
 @BUILD_LIBQUADMATH_TRUE@       math/floorq.lo math/powq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/fmaq.lo math/cacoshq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/cacosq.lo math/casinhq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/casinq.lo math/catanhq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/catanq.lo math/cimagq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/conjq.lo math/cprojq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/crealq.lo math/fdimq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/fmaxq.lo math/fminq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/ilogbq.lo math/llrintq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/log2q.lo math/lrintq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/nearbyintq.lo math/remquoq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/ccoshq.lo math/cexpq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/clog10q.lo math/clogq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/csinq.lo math/csinhq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/csqrtq.lo math/ctanq.lo \
-@BUILD_LIBQUADMATH_TRUE@       math/ctanhq.lo printf/addmul_1.lo \
-@BUILD_LIBQUADMATH_TRUE@       printf/add_n.lo printf/cmp.lo \
-@BUILD_LIBQUADMATH_TRUE@       printf/divrem.lo printf/flt1282mpn.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/fmaq.lo math/logbq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/cacoshq.lo math/cacosq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/casinhq.lo math/casinq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/catanhq.lo math/catanq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/cimagq.lo math/conjq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/cprojq.lo math/crealq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/fdimq.lo math/fmaxq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/fminq.lo math/ilogbq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/llrintq.lo math/log2q.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/lrintq.lo math/nearbyintq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/remquoq.lo math/ccoshq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/cexpq.lo math/clog10q.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/clogq.lo math/csinq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/csinhq.lo math/csqrtq.lo \
+@BUILD_LIBQUADMATH_TRUE@       math/ctanq.lo math/ctanhq.lo \
+@BUILD_LIBQUADMATH_TRUE@       printf/addmul_1.lo printf/add_n.lo \
+@BUILD_LIBQUADMATH_TRUE@       printf/cmp.lo printf/divrem.lo \
+@BUILD_LIBQUADMATH_TRUE@       printf/flt1282mpn.lo \
 @BUILD_LIBQUADMATH_TRUE@       printf/fpioconst.lo printf/lshift.lo \
 @BUILD_LIBQUADMATH_TRUE@       printf/mul_1.lo printf/mul_n.lo \
 @BUILD_LIBQUADMATH_TRUE@       printf/mul.lo printf/printf_fphex.lo \
@@ -368,7 +369,7 @@ AUTOMAKE_OPTIONS = 1.8 foreign
 @BUILD_LIBQUADMATH_TRUE@  math/erfq.c math/logq.c math/sqrtq.c math/expm1q.c math/lroundq.c \
 @BUILD_LIBQUADMATH_TRUE@  math/tanhq.c math/expq.c math/modfq.c math/tanq.c math/fabsq.c \
 @BUILD_LIBQUADMATH_TRUE@  math/nanq.c math/tgammaq.c math/finiteq.c math/nextafterq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/truncq.c math/floorq.c math/powq.c math/fmaq.c \
+@BUILD_LIBQUADMATH_TRUE@  math/truncq.c math/floorq.c math/powq.c math/fmaq.c math/logbq.c \
 @BUILD_LIBQUADMATH_TRUE@  math/cacoshq.c math/cacosq.c math/casinhq.c math/casinq.c \
 @BUILD_LIBQUADMATH_TRUE@  math/catanhq.c math/catanq.c math/cimagq.c math/conjq.c math/cprojq.c \
 @BUILD_LIBQUADMATH_TRUE@  math/crealq.c math/fdimq.c math/fmaxq.c math/fminq.c math/ilogbq.c \
@@ -607,6 +608,7 @@ math/truncq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/floorq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/powq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/fmaq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
+math/logbq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/cacoshq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/cacosq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
 math/casinhq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
@@ -809,6 +811,8 @@ mostlyclean-compile:
        -rm -f math/log1pq.lo
        -rm -f math/log2q.$(OBJEXT)
        -rm -f math/log2q.lo
+       -rm -f math/logbq.$(OBJEXT)
+       -rm -f math/logbq.lo
        -rm -f math/logq.$(OBJEXT)
        -rm -f math/logq.lo
        -rm -f math/lrintq.$(OBJEXT)
@@ -967,6 +971,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/log10q.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/log1pq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/log2q.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/logbq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/logq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/lrintq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/lroundq.Plo@am__quote@
index 4b8e6983cc0e5e09ab1db8d243a87b3dc69c5353..c25b094feec4562a1dc672d983b409ae714d359a 100644 (file)
@@ -180,6 +180,7 @@ The following mathematical functions are available:
 @item @code{lgammaq}: logarithmic gamma function
 @item @code{llrintq}: round to nearest integer value
 @item @code{llroundq}: round to nearest integer value away from zero
+@item @code{logbq}: get exponent of the value
 @item @code{logq}: natural logarithm function
 @item @code{log10q}: base 10 logarithm function
 @item @code{log1pq}: compute natural logarithm of the value plus one
diff --git a/libquadmath/math/logbq.c b/libquadmath/math/logbq.c
new file mode 100644 (file)
index 0000000..2e47a4b
--- /dev/null
@@ -0,0 +1,47 @@
+/* s_logbl.c -- long double version of s_logb.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * long double logbl(x)
+ * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
+ * Use ilogb instead.
+ */
+
+#include "quadmath-imp.h"
+
+__float128
+logbq (__float128 x)
+{
+  int64_t lx, hx, ex;
+
+  GET_FLT128_WORDS64 (hx, lx, x);
+  hx &= 0x7fffffffffffffffLL;  /* high |x| */
+  if ((hx | lx) == 0)
+    return -1.0 / fabsq (x);
+  if (hx >= 0x7fff000000000000LL)
+    return x * x;
+  if ((ex = hx >> 48) == 0)    /* IEEE 754 logb */
+    {
+      /* POSIX specifies that denormal number is treated as
+         though it were normalized.  */
+      int ma;
+      if (hx == 0)
+       ma = __builtin_clzll (lx) + 64;
+      else
+       ma = __builtin_clzll (hx);
+      ex -= ma - 16;
+    }
+  return (__float128) (ex - 16383);
+}
index aa9ef51b39194b854c300d480bf32ba7e0fc96fc..1555304c7f928355584fd6c09fd1bbb15905c5ef 100644 (file)
@@ -76,6 +76,7 @@ extern __float128 ldexpq (__float128, int) __quadmath_throw;
 extern __float128 lgammaq (__float128) __quadmath_throw;
 extern long long int llrintq (__float128) __quadmath_throw;
 extern long long int llroundq (__float128) __quadmath_throw;
+extern __float128 logbq (__float128) __quadmath_throw;
 extern __float128 logq (__float128) __quadmath_throw;
 extern __float128 log10q (__float128) __quadmath_throw;
 extern __float128 log2q (__float128) __quadmath_throw;
index 2d20280229e369b4d7109854ae3f5ae73659e536..fe816e3215d94f2b881e18ba98fc4cb79ec516d1 100644 (file)
@@ -96,3 +96,8 @@ QUADMATH_1.0 {
   local:
     *;
 };
+
+QUADMATH_1.1 {
+  global:
+    logbq;
+} QUADMATH_1.0;
index 986079abc406921d353c3dd8c35a21a0fccecf05..db5d529612a452b90f2d223bf4f286752d8a1ab7 100644 (file)
@@ -72,6 +72,7 @@ __qmath3 (ldexpq)
 __qmath3 (lgammaq)
 __qmath3 (llrintq)
 __qmath3 (llroundq)
+__qmath3 (logbq)
 __qmath3 (logq)
 __qmath3 (log10q)
 __qmath3 (log1pq)