This is an archive of the discontinued LLVM Phabricator instance.

[libc][math] Added auxiliary function log2_eval for asinhf/acoshf/atanhf.
ClosedPublic

Authored by orex on Aug 28 2022, 10:14 AM.

Details

Summary
  1. double log2_eval(double) function added with better than float precision is added.
  2. Some refactoring done to put all auxiliary functions and corresponding data

to one place to reuse the code.

  1. Added tests for new functions.
  2. Performance and precision tests of the function shows, that it more precise than exiting log2,

(no exceptional cases), but timing is ~5% higer that on current one.

Diff Detail

Event Timeline

orex created this revision.Aug 28 2022, 10:14 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 28 2022, 10:14 AM
orex requested review of this revision.Aug 28 2022, 10:14 AM
lntue added inline comments.Aug 29 2022, 1:03 PM
libc/src/math/generic/expxf.h
0

explogxf.h is a better name for this file and cmake target.

15

Add comments about how the coefficients are generated.

42

Add comment about what the constant is and how it is generated.

49

Add comment about what the constant is and how it is generated.

libc/src/math/generic/supfuncf.cpp
28 ↗(On Diff #456193)

Add comments about how these constants are defined and generated. The same for other tables below.

orex updated this revision to Diff 456457.Aug 29 2022, 2:13 PM

Constants description added.

orex updated this revision to Diff 456458.Aug 29 2022, 2:17 PM

Fix wrong upload.

orex marked 3 inline comments as done.Aug 29 2022, 2:18 PM
orex added inline comments.
libc/src/math/generic/expxf.h
0

Please check also D132811 I've added to the file also atan_eval function, so therefore it is named such. If you have any other suggestion about the file name I'll appreciate your suggestion.

lntue added inline comments.Aug 29 2022, 2:45 PM
libc/src/math/generic/expxf.h
0

The constants and atan_eval function that you added in https://reviews.llvm.org/D132842 are independent with these exp and log utilities. Maybe you can put them into separate files / target called inv_trig_utils or inv_trig_helpers, as I expect asin and acos will also need some helpers, which could be put in there.

orex updated this revision to Diff 456752.Aug 30 2022, 12:26 PM

Review fixes.

orex added a comment.Aug 30 2022, 12:27 PM

The aux functions are split into two files according @lntue suggestion.

lntue accepted this revision.Aug 30 2022, 12:36 PM
This revision is now accepted and ready to land.Aug 30 2022, 12:36 PM
libc/test/src/math/explogxf_test.cpp