llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[libc][math] Add float-only versions for `inv_trigf_utils.h`

Open Sukumarsawant opened this issue 5 months ago • 3 comments

Currently, the inverse trig utility functions in libc/src/__support/math/inv_trigf_utils.h perform all intermediate computations in double precision. This is inefficient for float16 and bfloat16 math functions.

We should provide float-only versions for inv_trigf_utils.h so that float16 and bfloat16 functions can use them efficiently. This is a tracking-issue for the same

Sukumarsawant avatar Jun 06 '26 19:06 Sukumarsawant

@llvm/issue-subscribers-libc

Author: Zorojuro (Sukumarsawant)

Currently, the inverse trig utility functions in `libc/src/__support/math/inv_trigf_utils.h` perform all intermediate computations in double precision. This is inefficient for float16 and bfloat16 math functions.

We should provide float-only versions for inv_trigf_utils.h so that float16 and bfloat16 functions can use them efficiently. This is a tracking-issue for the same

@Sukumarsawant Hi, is anyone currently working on this issue? If not, I’d like to take it on.

I checked the latest code and noticed that inv_trigf_utils.h no longer exists; the relevant helpers now live in files such as asin_utils.h and atan_utils.h. Some functions, including asinf16 and atanbf16, already use float-only polynomial evaluations, while asinbf16 and acosbf16 still call the double-precision asin_eval helper.

I’d like to start by adding a float-only helper for asinbf16 and acosbf16, validating accuracy across rounding modes, and measuring the performance impact. Would this be a reasonable initial scope?

ChenMiaoi avatar Oct 03 '26 15:10 ChenMiaoi

sure, assigned .

Sukumarsawant avatar Oct 03 '26 15:10 Sukumarsawant