[libc-dev] Fwd: correctly rounded mathematical functions

Tue Ly via libc-dev libc-dev at lists.llvm.org
Wed Jan 5 10:40:21 PST 2022


A message from Paul Zimmermann about the CORE-MATH project to LLVM-libc
developers.

---------- Forwarded message ---------
From: Paul Zimmermann <Paul.Zimmermann at inria.fr>
Date: Mon, Jan 3, 2022 at 9:35 AM
Subject: correctly rounded mathematical functions
To: <lntue at google.com>
Cc: <sibid at uvic.ca>, <christoph.lauter at christoph-lauter.org>, <
Jean-Michel.Muller at ens-lyon.fr>


      Dear Tue,

you are already aware of the CORE-MATH project, but please forward to anyone
interested within LLVM.

Best regards,
Paul

PS: new functions sinf and cosf are available on the CORE-MATH page,
tanf will soon follow.

##############################################################################

      Dear llvm-libc developers,

the current C working draft [1, p392] has reserved names for correctly
rounded functions (cr_exp, cr_log, cr_sin, ...).

We propose to provide such correctly rounded implementations
for the three IEEE formats (binary32, binary64, binary128) and the
"extended double" format (long double on x86_64).

These implementations will be correctly rounded for all rounding modes,
for example one could do the following to emulate interval arithmetic:

   fesetround (FE_DOWNWARD);
   y_lo = cr_exp (x_lo);
   fesetround (FE_UPWARD);
   y_hi = cr_exp (x_hi);

Users who want a fast implementation will call the exp/log/sin/...
functions,
users who want a correctly rounded function and thus reproducible results
(whatever the hardware, compiler or operating system) will use the
cr_exp/cr_log/cr_sin/... functions. Our goal is nevertheless to get the
best performance possible.

Our objective is to provide open-source implementations that can be
integrated
in the major mathematical libraries (GNU libc, Intel Math Library, AMD Libm,
Redhat Newlib, OpenLibm, Musl, llvm-libc, CUDA, ROCm).

Are developers of llvm-libc interested by such functions?
If so, we could discuss what would be the requirements for integration in
llvm-libc in terms of license, table size, allowed operations.

We have started to work on two functions (cbrt and acos), for which we
provide presumably correctly rounded implementations (up to the knowledge
of hard-to-round cases) [2].

Christoph Lauter
Jean-Michel Muller
Alexei Sibidanov
Paul Zimmermann

[1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf
[2] https://homepages.loria.fr/PZimmermann/CORE-MATH/


-- 

Tue Ly |  Software Engineer |  lntue at google.com |  +16176850921
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libc-dev/attachments/20220105/1909ab01/attachment.html>


More information about the libc-dev mailing list