[all-commits] [llvm/llvm-project] 6168b4: [libc] Improve the performance of expf.
lntue via All-commits
all-commits at lists.llvm.org
Fri Mar 25 09:20:46 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6168b422258e41087a5393b7b77a7349a8922a68
https://github.com/llvm/llvm-project/commit/6168b422258e41087a5393b7b77a7349a8922a68
Author: Tue Ly <lntue at google.com>
Date: 2022-03-25 (Fri, 25 Mar 2022)
Changed paths:
M libc/src/math/generic/expf.cpp
M libc/test/src/math/exhaustive/expf_test.cpp
M libc/test/src/math/expf_test.cpp
Log Message:
-----------
[libc] Improve the performance of expf.
Reduce the polynomial's degree from 7 down to 4.
Currently we use a degree-7 minimax polynomial on an interval of length 2^-7
around 0 to compute `expf`. Based on the suggestion of @santoshn and the RLIBM
project (https://github.com/rutgers-apl/rlibm-all/blob/main/source/float/exp.c)
and the improvement we made with `exp2f` in https://reviews.llvm.org/D122346,
it is possible to have a good polynomial of degree-4 on a subinterval of length
2^(-7) to approximate e^x.
We did try to either reduce the degree of the polynomial down to 3 or increase
the interval size to 2^(-6), but in both cases the number of exceptional values
exploded. So we settle with using a degree-4 polynomial of the interval of
size 2^(-7) around 0.
Reviewed By: sivachandra, zimmermann6, santoshn
Differential Revision: https://reviews.llvm.org/D122418
More information about the All-commits
mailing list