summaryrefslogtreecommitdiff
path: root/libc/src/math/generic/powf.cpp
AgeCommit message (Collapse)Author
2025-04-08[libc][math] Fix signaling NaN handling for math functions. (#133347)wldfngrs
Add tests for signaling NaNs, and fix function behavior for handling signaling NaN input. Fixes https://github.com/llvm/llvm-project/issues/124812
2025-03-11[libc] Provide more fine-grained control of FMA instruction for ARM targets. ↵lntue
(#130700)
2025-03-05[libc][math] Add skip accurate pass option for exp*, log*, and powf ↵lntue
functions. (#129831)
2024-10-26[libc][math] Add tests and fix some issues with FTZ/DAZ modes. (#113744)lntue
2024-10-18[libc][math] Fix signed zeros for powf when underflow happens. (#112601)lntue
2024-10-05[libc] remove errno.h includes (#110934)Job Henandez Lara
2024-10-01[libc][math] Fix exceptional cases pow(-0, 1/2) and pow(-inf, 1/2). (#110566)lntue
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2024-06-13[libc][math][c23] Add f16sqrtf C23 math function (#95251)OverMighty
Part of #95250.
2024-05-10[libc][math] Fix exact cases for powf. (#91488)lntue
It was reported from the CORE-MATH project that the `powf` implementation did not round correctly when `x^y` is either exact for exactly half-way. This PR deals with the potential exact cases when `y` is an integer `2 < y < 25`. In such cases, the results of `x^y` is exactly representable in double precision.
2024-03-20[libc][NFC] Move `Sign` type to separate header (#85930)Guillaume Chatelet
2024-01-30[libc][NFC] Rename `FPBits` nan functions (#79998)Guillaume Chatelet
- [libc][NFC] Rename FPBits nan functions - rename build_signaling_nan in signaling_nan - rename build_quiet_nan to quiet_nan
2024-01-23[reland][libc] Remove unnecessary `FPBits` functions and properties (#79128)Guillaume Chatelet
- reland #79113 - Fix aarch64 RISC-V build
2024-01-23Revert "[libc] Remove unnecessary `FPBits` functions and properties" (#79118)Guillaume Chatelet
Reverts llvm/llvm-project#79113 It broke aarch64 build bot machines.
2024-01-23[libc] Remove unnecessary `FPBits` functions and properties (#79113)Guillaume Chatelet
This patch reduces the surface of `FPBits`.
2024-01-18[libc][NFC] Introduce a Sign type for FPBits (#78500)Guillaume Chatelet
Another patch is needed to cover `DyadicFloat` and `NormalFloat` constructors.
2024-01-03[libc][NFC] Remove `FloatProperties` (#76508)Guillaume Chatelet
Access is now done through `FPBits` exclusively. This patch also renames a few internal structs and uses `T` instead of `FP` as a template parameter.
2023-12-19[libc][NFC] Make `EXP_MANT_MASK` an implementation detail (#75810)Guillaume Chatelet
This mask is an implementation detail of `FPBits` and shouldn't really leak outside of it.
2023-12-15[libc][NFC] Rename `MANTISSA_WIDTH` in `FRACTION_LEN` (#75489)Guillaume Chatelet
This one might be a bit controversial since the terminology has been introduced from the start but I think `FRACTION_LEN` is a better name here. AFAICT it really is "the number of bits after the decimal dot when the number is in normal form." `MANTISSA_WIDTH` is less precise as it's unclear whether we take the leading bit into account. This patch also renames most of the properties to use the `_LEN` suffix and fixes useless casts or variables.
2023-12-12[libc][NFC] Make EXPONENT_BIAS int32_t (#75046)Guillaume Chatelet
`EXPONENT_BIAS` is almost always used with signed arithmetic. Making it an `int32_t` from the start reduces the chances to run into implementation defined behavior (cast from unsigned to signed is implementation-defined until C++20). https://en.cppreference.com/w/cpp/language/implicit_conversion#:~:text=If%20the%20destination%20type%20is%20signed,arithmetic%20overflow%2C%20which%20is%20undefined).
2023-12-11[libc][NFC] Fix mixed up biased/unbiased exponent (#75037)Guillaume Chatelet
According to [wikipedia](https://en.wikipedia.org/wiki/Exponent_bias) the "biased exponent" is the encoded form that is always positive whereas the unbiased form is the actual "real" exponent that can be positive or negative. `FPBits` seems to be using `unbiased_exponent` to describe the encoded form (unsigned). This patch simply use `biased` instead of `unbiased`.
2023-12-05[reland][libc][NFC] Remove __support/bit.h and use __support/CPP/bit.h ↵Guillaume Chatelet
instead (#73939) (#74446) Same as #73939 but also fix `libc/src/string/memory_utils/op_aarch64.h` that was still using `deferred_static_assert`.
2023-12-05Revert "[libc][NFC] Remove __support/bit.h and use __support/CPP/bit.h ↵Guillaume Chatelet
instead" (#74444) Reverts llvm/llvm-project#73939 This broke libc-aarch64-ubuntu build bot https://lab.llvm.org/buildbot/#/builders/138/builds/56186
2023-12-05[libc][NFC] Remove __support/bit.h and use __support/CPP/bit.h instead (#73939)Guillaume Chatelet
2023-11-23[libc][NFC] Split builtin_wrapper into bit and math_extras (#73113)Guillaume Chatelet
Split `builtin_wrapper.h` into `bit.h` and `math_extras.h` to mimic LLVM `llvm/ADT/Bit.h` and `llvm/Support/MathExtras.h`. Also added unittest place holders.
2023-11-06[libc][math] Add min/max/min_denorm/max_denorm constants to FPBits and clean ↵lntue
up its constants return types. (#71298)
2023-11-06[libc][math] Implement powf function correctly rounded to all rounding ↵lntue
modes. (#71188) We compute `pow(x, y)` using the formula ``` pow(x, y) = x^y = 2^(y * log2(x)) ``` We follow similar steps as in `log2f(x)` and `exp2f(x)`, by breaking down into `hi + mid + lo` parts, in which `hi` parts are computed using the exponent field directly, `mid` parts will use look-up tables, and `lo` parts are approximated by polynomials. We add some speedup for common use-cases: ``` pow(2, y) = exp2(y) pow(10, y) = exp10(y) pow(x, 2) = x * x pow(x, 1/2) = sqrt(x) pow(x, -1/2) = rsqrt(x) - to be added ```