public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Carlos O'Donell <carlos@redhat.com>,
	Joseph Myers <josmyers@redhat.com>,
	libc-alpha@sourceware.org
Subject: Re: Implement C23 log2p1
Date: Mon, 15 Apr 2024 10:52:43 -0300	[thread overview]
Message-ID: <dbf8e1cb-6fa3-4fdc-a1df-0f62bcce2733@linaro.org> (raw)
In-Reply-To: <7f721503-e65d-4901-9369-833c00b01004@redhat.com>



On 15/04/24 10:41, Carlos O'Donell wrote:
> On 4/8/24 17:19, Joseph Myers wrote:
>> C23 adds various <math.h> function families originally defined in TS
>> 18661-4.  Add the log2p1 functions (log2(1+x): like log1p, but for
>> base-2 logarithms).
>>
>> This illustrates the intended structure of implementations of all
>> these function families: define them initially with a type-generic
>> template implementation.  If someone wishes to add type-specific
>> implementations, it is likely such implementations can be both faster
>> and more accurate than the type-generic one and can then override it
>> for types for which they are implemented (adding benchmarks would be
>> desirable in such cases to demonstrate that a new implementation is
>> indeed faster).
>>
>> The test inputs are copied from those for log1p.  Note that these
>> changes make gen-auto-libm-tests depend on MPFR 4.2 (or later).
>>
>> The bulk of the changes are fairly generic for any such new function.
>> (sysdeps/powerpc/nofpu/Makefile only needs changing for those
>> type-generic templates that use fabs.)
>>
>> Tested for x86_64 and x86, and with build-many-glibcs.py.
> 
> This fails CI for glibc:
> https://patchwork.sourceware.org/project/glibc/patch/41a4a6c9-4942-a9be-9459-1aaeb44ffee8@redhat.com/
> 
> Please review the results and work with Linaro to ensure this passes.
> 

These are the required ULPs update for arm and powerpc:

diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
index 116a5404f5..43aa07ba10 100644
--- a/sysdeps/aarch64/libm-test-ulps
+++ b/sysdeps/aarch64/libm-test-ulps
@@ -1355,6 +1355,26 @@ double: 3
 float: 3
 ldouble: 1
 
+Function: "log2p1":
+double: 1
+float: 1
+ldouble: 3
+
+Function: "log2p1_downward":
+double: 2
+float: 2
+ldouble: 3
+
+Function: "log2p1_towardzero":
+double: 2
+float: 2
+ldouble: 2
+
+Function: "log2p1_upward":
+double: 1
+float: 2
+ldouble: 2
+
 Function: "log_advsimd":
 double: 1
 float: 3
diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
index 5720e73288..fc7ba1439a 100644
--- a/sysdeps/arm/libm-test-ulps
+++ b/sysdeps/arm/libm-test-ulps
@@ -965,6 +965,22 @@ Function: "log2_upward":
 double: 3
 float: 3
 
+Function: "log2p1":
+double: 1
+float: 1
+
+Function: "log2p1_downward":
+double: 2
+float: 2
+
+Function: "log2p1_towardzero":
+double: 2
+float: 2
+
+Function: "log2p1_upward":
+double: 1
+float: 2
+
 Function: "log_downward":
 float: 2
 
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index dbf71d8194..78e9a9ad6e 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1506,6 +1506,30 @@ float: 3
 float128: 1
 ldouble: 4
 
+Function: "log2p1":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "log2p1_downward":
+double: 2
+float: 2
+float128: 3
+ldouble: 4
+
+Function: "log2p1_towardzero":
+double: 2
+float: 2
+float128: 2
+ldouble: 4
+
+Function: "log2p1_upward":
+double: 1
+float: 2
+float128: 2
+ldouble: 4
+
 Function: "log_downward":
 float: 2
 float128: 1

  reply	other threads:[~2024-04-15 13:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08 21:19 Joseph Myers
2024-04-10  8:31 ` Paul Zimmermann
2024-04-10 14:34   ` Joseph Myers
2024-04-10 14:46     ` Paul Zimmermann
2024-04-10 15:00       ` Joseph Myers
2024-04-15 13:41 ` Carlos O'Donell
2024-04-15 13:52   ` Adhemerval Zanella Netto [this message]
2024-04-18 13:26   ` Joseph Myers
2024-04-29 13:34 ` Ping " Joseph Myers
2024-04-29 13:51   ` Paul Zimmermann
2024-05-07 21:34   ` Ping^2 " Joseph Myers
2024-05-16 16:47     ` Ping^3 " Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dbf8e1cb-6fa3-4fdc-a1df-0f62bcce2733@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=josmyers@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).