* [libquadmath, patch] Add logbq() to libquadmath
@ 2015-08-03 21:04 FX
2015-08-09 6:27 ` FX
0 siblings, 1 reply; 10+ messages in thread
From: FX @ 2015-08-03 21:04 UTC (permalink / raw)
To: gcc-patches; +Cc: gfortran, Tobias Burnus, Jakub Jelinek
[-- Attachment #1: Type: text/plain, Size: 301 bytes --]
The attached patch adds logbq() to libquadmath, with code lifted from glibc.
It is made necessary by an upcoming patch for gfortran, adding full support for the IEEE modules on __float128, and requires logbq().
Bootstrapped and regtested on x86_64-apple-darwin14.
OK to commit to trunk?
FX
[-- Attachment #2: logbq.ChangeLog --]
[-- Type: application/octet-stream, Size: 301 bytes --]
2015-08-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* Makefile.am (libquadmath_la_SOURCES):
* 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
[-- Attachment #3: logbq.diff --]
[-- Type: application/octet-stream, Size: 4004 bytes --]
Index: Makefile.am
===================================================================
--- Makefile.am (revision 226429)
+++ Makefile.am (working copy)
@@ -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: libquadmath.texi
===================================================================
--- libquadmath.texi (revision 226429)
+++ libquadmath.texi (working copy)
@@ -180,6 +180,7 @@ The following mathematical functions are
@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
Index: math/logbq.c
===================================================================
--- math/logbq.c (revision 0)
+++ math/logbq.c (working copy)
@@ -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: quadmath.h
===================================================================
--- quadmath.h (revision 226429)
+++ quadmath.h (working copy)
@@ -76,6 +76,7 @@ extern __float128 ldexpq (__float128, in
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: quadmath.map
===================================================================
--- quadmath.map (revision 226429)
+++ quadmath.map (working copy)
@@ -96,3 +96,8 @@ QUADMATH_1.0 {
local:
*;
};
+
+QUADMATH_1.1 {
+ global:
+ logbq;
+} QUADMATH_1.0;
Index: quadmath_weak.h
===================================================================
--- quadmath_weak.h (revision 226429)
+++ quadmath_weak.h (working copy)
@@ -72,6 +72,7 @@ __qmath3 (ldexpq)
__qmath3 (lgammaq)
__qmath3 (llrintq)
__qmath3 (llroundq)
+__qmath3 (logbq)
__qmath3 (logq)
__qmath3 (log10q)
__qmath3 (log1pq)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libquadmath, patch] Add logbq() to libquadmath
2015-08-03 21:04 [libquadmath, patch] Add logbq() to libquadmath FX
@ 2015-08-09 6:27 ` FX
2015-08-09 7:08 ` Paul Richard Thomas
2015-08-09 7:09 ` Richard Biener
0 siblings, 2 replies; 10+ messages in thread
From: FX @ 2015-08-09 6:27 UTC (permalink / raw)
To: gcc-patches; +Cc: gfortran, Tobias Burnus, Jakub Jelinek
[-- Attachment #1: Type: text/plain, Size: 453 bytes --]
ping
In the apparent absence of the libquadmath maintainers, could a global reviewer approve this rather simple patch, please?
> The attached patch adds logbq() to libquadmath, with code lifted from glibc.
> It is made necessary by an upcoming patch for gfortran, adding full support for the IEEE modules on __float128, and requires logbq().
>
> Bootstrapped and regtested on x86_64-apple-darwin14.
> OK to commit to trunk?
>
> FX
[-- Attachment #2: logbq.diff --]
[-- Type: application/octet-stream, Size: 4004 bytes --]
Index: Makefile.am
===================================================================
--- Makefile.am (revision 226429)
+++ Makefile.am (working copy)
@@ -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: libquadmath.texi
===================================================================
--- libquadmath.texi (revision 226429)
+++ libquadmath.texi (working copy)
@@ -180,6 +180,7 @@ The following mathematical functions are
@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
Index: math/logbq.c
===================================================================
--- math/logbq.c (revision 0)
+++ math/logbq.c (working copy)
@@ -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: quadmath.h
===================================================================
--- quadmath.h (revision 226429)
+++ quadmath.h (working copy)
@@ -76,6 +76,7 @@ extern __float128 ldexpq (__float128, in
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: quadmath.map
===================================================================
--- quadmath.map (revision 226429)
+++ quadmath.map (working copy)
@@ -96,3 +96,8 @@ QUADMATH_1.0 {
local:
*;
};
+
+QUADMATH_1.1 {
+ global:
+ logbq;
+} QUADMATH_1.0;
Index: quadmath_weak.h
===================================================================
--- quadmath_weak.h (revision 226429)
+++ quadmath_weak.h (working copy)
@@ -72,6 +72,7 @@ __qmath3 (ldexpq)
__qmath3 (lgammaq)
__qmath3 (llrintq)
__qmath3 (llroundq)
+__qmath3 (logbq)
__qmath3 (logq)
__qmath3 (log10q)
__qmath3 (log1pq)
[-- Attachment #3: logbq.ChangeLog --]
[-- Type: application/octet-stream, Size: 301 bytes --]
2015-08-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* Makefile.am (libquadmath_la_SOURCES):
* 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libquadmath, patch] Add logbq() to libquadmath
2015-08-09 6:27 ` FX
@ 2015-08-09 7:08 ` Paul Richard Thomas
2015-08-09 7:13 ` Paul Richard Thomas
2015-08-09 7:09 ` Richard Biener
1 sibling, 1 reply; 10+ messages in thread
From: Paul Richard Thomas @ 2015-08-09 7:08 UTC (permalink / raw)
To: FX; +Cc: gcc-patches, gfortran, Tobias Burnus, Jakub Jelinek
Dear FX,
I looks OK to me - as you say, it's rather simple. Good for trunk.
Thanks for the patch
Paul
On 9 August 2015 at 08:27, FX <fxcoudert@gmail.com> wrote:
> ping
>
> In the apparent absence of the libquadmath maintainers, could a global reviewer approve this rather simple patch, please?
>
>
>
>> The attached patch adds logbq() to libquadmath, with code lifted from glibc.
>> It is made necessary by an upcoming patch for gfortran, adding full support for the IEEE modules on __float128, and requires logbq().
>>
>> Bootstrapped and regtested on x86_64-apple-darwin14.
>> OK to commit to trunk?
>>
>> FX
>
--
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.
Groucho Marx
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libquadmath, patch] Add logbq() to libquadmath
2015-08-09 6:27 ` FX
2015-08-09 7:08 ` Paul Richard Thomas
@ 2015-08-09 7:09 ` Richard Biener
2015-08-09 8:47 ` FX
1 sibling, 1 reply; 10+ messages in thread
From: Richard Biener @ 2015-08-09 7:09 UTC (permalink / raw)
To: FX, gcc-patches; +Cc: gfortran, Tobias Burnus, Jakub Jelinek
On August 9, 2015 8:27:09 AM GMT+02:00, FX <fxcoudert@gmail.com> wrote:
>ping
>
>In the apparent absence of the libquadmath maintainers, could a global
>reviewer approve this rather simple patch, please?
OK
Richard
>
>
>> The attached patch adds logbq() to libquadmath, with code lifted from
>glibc.
>> It is made necessary by an upcoming patch for gfortran, adding full
>support for the IEEE modules on __float128, and requires logbq().
>>
>> Bootstrapped and regtested on x86_64-apple-darwin14.
>> OK to commit to trunk?
>>
>> FX
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libquadmath, patch] Add logbq() to libquadmath
2015-08-09 7:08 ` Paul Richard Thomas
@ 2015-08-09 7:13 ` Paul Richard Thomas
0 siblings, 0 replies; 10+ messages in thread
From: Paul Richard Thomas @ 2015-08-09 7:13 UTC (permalink / raw)
To: FX; +Cc: gcc-patches, gfortran, Tobias Burnus, Jakub Jelinek
Sorry - I missed the "global"
Paul
On 9 August 2015 at 09:08, Paul Richard Thomas
<paul.richard.thomas@gmail.com> wrote:
> Dear FX,
>
> I looks OK to me - as you say, it's rather simple. Good for trunk.
>
> Thanks for the patch
>
> Paul
>
> On 9 August 2015 at 08:27, FX <fxcoudert@gmail.com> wrote:
>> ping
>>
>> In the apparent absence of the libquadmath maintainers, could a global reviewer approve this rather simple patch, please?
>>
>>
>>
>>> The attached patch adds logbq() to libquadmath, with code lifted from glibc.
>>> It is made necessary by an upcoming patch for gfortran, adding full support for the IEEE modules on __float128, and requires logbq().
>>>
>>> Bootstrapped and regtested on x86_64-apple-darwin14.
>>> OK to commit to trunk?
>>>
>>> FX
>>
>
>
>
> --
> Outside of a dog, a book is a man's best friend. Inside of a dog it's
> too dark to read.
>
> Groucho Marx
--
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.
Groucho Marx
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libquadmath, patch] Add logbq() to libquadmath
2015-08-09 7:09 ` Richard Biener
@ 2015-08-09 8:47 ` FX
0 siblings, 0 replies; 10+ messages in thread
From: FX @ 2015-08-09 8:47 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches, gfortran, Tobias Burnus, Jakub Jelinek
>> In the apparent absence of the libquadmath maintainers, could a global
>> reviewer approve this rather simple patch, please?
>
> OK
Committed as rev. 226748. Thanks.
FX
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libquadmath, patch] Add logbq() to libquadmath
2015-08-05 13:43 ` Dominique d'Humières
@ 2015-08-06 8:39 ` FX
0 siblings, 0 replies; 10+ messages in thread
From: FX @ 2015-08-06 8:39 UTC (permalink / raw)
To: Dominique d'Humières; +Cc: GNU GFortran, GCC Patches
> With the updated patch the test gfortran.dg/ieee/large_1.f90 compiles, but fails at run time due to the lines
>
> if (.not. ieee_support_underflow_control(x1)) call abort
>
> and
>
> if (.not. ieee_support_underflow_control(x2)) call abort
>
> IIRC Uros said that underflow id not supported for __float128.
Indeed. I fixed the code, but forgot to commit the testcase. Now done as revision 226665.
FX
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libquadmath, patch] Add logbq() to libquadmath
2015-08-05 13:11 ` FX
@ 2015-08-05 13:43 ` Dominique d'Humières
2015-08-06 8:39 ` FX
0 siblings, 1 reply; 10+ messages in thread
From: Dominique d'Humières @ 2015-08-05 13:43 UTC (permalink / raw)
To: FX; +Cc: GNU GFortran, GCC Patches
> Le 5 août 2015 à 15:11, FX <fxcoudert@gmail.com> a écrit :
>
>> AFAICT there is something missing in the patch: I do not see any compilation of math/logbq.c and indeed no trace of logbq in libquadmath. What I am missing?
>
> Maybe you didn’t regenerate the Makefile.in?
Indeed I did not!-(I have never succeeded with the regenerate process: not the right version, …).
> The patch was sent without this regenerated file, as is (as I understand) the custom on gcc-patches.
>
> Attached is the full diff, including Makefile.in.
With the updated patch the test gfortran.dg/ieee/large_1.f90 compiles, but fails at run time due to the lines
if (.not. ieee_support_underflow_control(x1)) call abort
and
if (.not. ieee_support_underflow_control(x2)) call abort
IIRC Uros said that underflow id not supported for __float128.
Thanks for the answer,
Dominique
>
> FX
>
> <x.diff>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libquadmath, patch] Add logbq() to libquadmath
2015-08-05 11:43 Dominique d'Humières
@ 2015-08-05 13:11 ` FX
2015-08-05 13:43 ` Dominique d'Humières
0 siblings, 1 reply; 10+ messages in thread
From: FX @ 2015-08-05 13:11 UTC (permalink / raw)
To: Dominique d'Humières; +Cc: GNU GFortran, GCC Patches
[-- Attachment #1: Type: text/plain, Size: 373 bytes --]
> AFAICT there is something missing in the patch: I do not see any compilation of math/logbq.c and indeed no trace of logbq in libquadmath. What I am missing?
Maybe you didn’t regenerate the Makefile.in?
The patch was sent without this regenerated file, as is (as I understand) the custom on gcc-patches.
Attached is the full diff, including Makefile.in.
FX
[-- Attachment #2: x.diff --]
[-- Type: application/octet-stream, Size: 8762 bytes --]
Index: Makefile.am
===================================================================
--- Makefile.am (revision 226429)
+++ Makefile.am (working copy)
@@ -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: Makefile.in
===================================================================
--- Makefile.in (revision 226429)
+++ Makefile.in (working copy)
@@ -140,23 +140,24 @@ am__dirstamp = $(am__leading_dot)dirstam
@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) mat
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: libquadmath.texi
===================================================================
--- libquadmath.texi (revision 226429)
+++ libquadmath.texi (working copy)
@@ -180,6 +180,7 @@ The following mathematical functions are
@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
Index: math/logbq.c
===================================================================
--- math/logbq.c (revision 0)
+++ math/logbq.c (working copy)
@@ -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: quadmath.h
===================================================================
--- quadmath.h (revision 226429)
+++ quadmath.h (working copy)
@@ -76,6 +76,7 @@ extern __float128 ldexpq (__float128, in
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: quadmath.map
===================================================================
--- quadmath.map (revision 226429)
+++ quadmath.map (working copy)
@@ -96,3 +96,8 @@ QUADMATH_1.0 {
local:
*;
};
+
+QUADMATH_1.1 {
+ global:
+ logbq;
+} QUADMATH_1.0;
Index: quadmath_weak.h
===================================================================
--- quadmath_weak.h (revision 226429)
+++ quadmath_weak.h (working copy)
@@ -72,6 +72,7 @@ __qmath3 (ldexpq)
__qmath3 (lgammaq)
__qmath3 (llrintq)
__qmath3 (llroundq)
+__qmath3 (logbq)
__qmath3 (logq)
__qmath3 (log10q)
__qmath3 (log1pq)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libquadmath, patch] Add logbq() to libquadmath
@ 2015-08-05 11:43 Dominique d'Humières
2015-08-05 13:11 ` FX
0 siblings, 1 reply; 10+ messages in thread
From: Dominique d'Humières @ 2015-08-05 11:43 UTC (permalink / raw)
To: FX Coudert; +Cc: GNU GFortran, GCC Patches
> The attached patch adds logbq() to libquadmath, with code lifted from glibc.
AFAICT there is something missing in the patch: I do not see any compilation of math/logbq.c and indeed no trace of logbq in libquadmath. What I am missing?
TIA
Dominique
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-08-09 8:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-03 21:04 [libquadmath, patch] Add logbq() to libquadmath FX
2015-08-09 6:27 ` FX
2015-08-09 7:08 ` Paul Richard Thomas
2015-08-09 7:13 ` Paul Richard Thomas
2015-08-09 7:09 ` Richard Biener
2015-08-09 8:47 ` FX
2015-08-05 11:43 Dominique d'Humières
2015-08-05 13:11 ` FX
2015-08-05 13:43 ` Dominique d'Humières
2015-08-06 8:39 ` FX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).