diff options
author | lntue <35648136+lntue@users.noreply.github.com> | 2024-07-08 10:02:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-08 10:02:12 -0400 |
commit | c9ee6b1977e7dc88e3bd89b5e361c703721711fd (patch) | |
tree | ef816b074c530df38efc82e8852411926263c697 /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 7e054c33d42b0a6bc8f6b168dab688f8e7762ef0 (diff) | |
download | llvm-c9ee6b1977e7dc88e3bd89b5e361c703721711fd.zip llvm-c9ee6b1977e7dc88e3bd89b5e361c703721711fd.tar.gz llvm-c9ee6b1977e7dc88e3bd89b5e361c703721711fd.tar.bz2 |
[libc][math] Implement cbrtf function correctly rounded to all rounding modes. (#97936)
Fixes https://github.com/llvm/llvm-project/issues/92874
Algorithm: Let `x = (-1)^s * 2^e * (1 + m)`.
- Step 1: Range reduction: reduce the exponent with:
```
y = cbrt(x) = (-1)^s * 2^(floor(e/3)) * 2^((e % 3)/3) * (1 + m)^(1/3)
```
- Step 2: Use the first 4 bit fractional bits of `m` to look up for a
degree-7 polynomial approximation to:
```
(1 + m)^(1/3) ~ 1 + m * P(m).
```
- Step 3: Perform the multiplication:
```
2^((e % 3)/3) * (1 + m)^(1/3).
```
- Step 4: Check for exact cases to prevent rounding and clear
`FE_INEXACT` floating point exception.
- Step 5: Combine with the exponent and sign before converting down to
`float` and return.
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions