[libc-commits] [PATCH] D122346: [libc] Improve the performance of exp2f.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Mar 23 12:47:20 PDT 2022


lntue created this revision.
lntue added reviewers: michaelrj, sivachandra, zimmermann6, santoshn.
Herald added subscribers: ecnelises, tschuett.
Herald added projects: libc-project, All.
lntue requested review of this revision.

Reduce the range-reduction table size from 128 entries down to 64 entries, and 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 exp2f.
Based on the suggestion of @santoshn and the RLIBM project (https://github.com/rutgers-api/rlibm-all/blob/main/source/float/exp2.c), it is possible to have a good polynomial of degree-4 on a subinterval of length 2^(-6) to approximate 2^x.
We did try to either reduce the degree of the polynomial down to 3 or increase the interval size to 2^(-5), 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^(-6) around 0.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122346

Files:
  libc/src/math/generic/exp2f.cpp
  libc/test/src/math/exp2f_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122346.417721.patch
Type: text/x-patch
Size: 13994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220323/6e87fc23/attachment.bin>


More information about the libc-commits mailing list