summaryrefslogtreecommitdiff
path: root/libc/test/src/math/exp10f_test.cpp
AgeCommit message (Collapse)Author
2025-09-10[libc] Clean up errno header usage in math tests. (#157898)Alexey Samsonov
This is one more follow-up to PR https://github.com/llvm/llvm-project/pull/157517 that cleans up the usage of libc_errno in math unit-tests (non-smoke). It follows the same rule: * if you use libc_errno in code literally, include src/__support/libc_errno.h * if you only rely on errno constants, include hdr/errno_macros.h Several tests for exp/log still retain the direct libc_errno usage, since in some cases they skip doing any validation if the error was raised. But the direct usage of libc_errno is removed from all other cases.
2025-07-23[libc][NFC] Add stdint.h proxy header to fix dependency issue with ↵lntue
<stdint.h> includes. (#150303) https://github.com/llvm/llvm-project/issues/149993
2025-06-11[libc] Move libc_errno.h to libc/src/__support and make ↵lntue
LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2024-07-28[libc] Create a separate proxy header for math-function-macros.h (#98430)Nhat Nguyen
Fix #98393
2024-04-05[libc] Add proxy header math_macros.h. (#87598)lntue
Context: https://github.com/llvm/llvm-project/pull/87017 - Add proxy header `libc/hdr/math_macros.h` that will: - include `<math.h>` in overlay mode, - include `"include/llvm-libc-macros/math-macros.h"` in full build mode. - Its corresponding CMake target `libc.hdr.math_macros` will only depend on `libc.include.math` and `libc.include.llvm-libc-macros.math_macros` in full build mode. - Replace all `#include "include/llvm-libc-macros/math-macros.h"` with `#include "hdr/math_macros.h"`. - Add dependency to `libc.hdr.math_macros` CMake target when using `add_fp_unittest`. - Update the remaining dependency. - Update bazel overlay: add `libc:hdr_math_macros` target, and replacing all dependency on `libc:llvm_libc_macros_math_macros` with `libc:hdr_math_macros`.
2024-03-18[libc] Remove direct math.h includes (#85324)Michael Jones
Reland of #84991 A downstream overlay mode user ran into issues with the isnan macro not working in our sources with a specific libc configuration. This patch replaces the last direct includes of math.h with our internal math_macros.h, along with the necessary build system changes.
2024-02-06[libc] Move libc_errno inside of LIBC_NAMESPACE (#80774)michaelrj-google
Having libc_errno outside of the namespace causes versioning issues when trying to link the tests against LLVM-libc. Most of this patch is just moving libc_errno inside the namespace in tests. This isn't necessary in the function implementations since those are already inside the namespace.
2024-01-23[libc][NFC] Remove `FPBits` cast operator (#79142)Guillaume Chatelet
The semantics for casting can range from "bitcast" (same representation) to "different representation", to "type promotion". Here we remove the cast operator and force usage of `get_val` as the only function to get the floating point value, making the intent clearer and more consistent.
2023-10-19[libc][math][NFC] Remove global scope constants declaration in math tests ↵lntue
(#69558) Clean up usage of `DECLARE_SPECIAL_CONSTANTS` in global scope.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-06-01[libc] Reduce math tests runtimeGuillaume Chatelet
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D151798
2023-03-13[libc][NFC] Switch all uses of errno in math and math tests to libc_errno.Siva Chandra Reddy
2023-03-07[libc][math] Switch math functions to use libc_errno and fix some errno and ↵Tue Ly
floating point exceptions. Switch math functions to use libc_errno and fix some errno and floating point exceptions Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D145349
2023-02-24[libc][math] Set floating point exceptions for exp*f, sinhf, and coshf.Tue Ly
Set FE_OVERFLOW and FE_UNDERFLOW for expf, exp2f, exp10f, expm1f, sinhf and coshf. Reviewed By: sivachandra, renyichen Differential Revision: https://reviews.llvm.org/D144340
2023-02-07[libc][NFC] Move UnitTest and IntegrationTest to the 'test' directory.Siva Chandra Reddy
This part of the effort to make all test related pieces into the `test` directory. This helps is excluding test related pieces in a straight forward manner if LLVM_INCLUDE_TESTS is OFF. Future patches will also move the MPFR wrapper and testutils into the 'test' directory.
2022-09-19[libc][math] Implement exp10f function correctly rounded to all rounding modes.Tue Ly
Implement exp10f function correctly rounded to all rounding modes. Algorithm: perform range reduction to reduce ``` 10^x = 2^(hi + mid) * 10^lo ``` where: ``` hi is an integer, 0 <= mid * 2^5 < 2^5 -log10(2) / 2^6 <= lo <= log10(2) / 2^6 ``` Then `2^mid` is stored in a table of 32 entries and the product `2^hi * 2^mid` is performed by adding `hi` into the exponent field of `2^mid`. `10^lo` is then approximated by a degree-5 minimax polynomials generated by Sollya with: ``` > P = fpminimax((10^x - 1)/x, 4, [|D...|], [-log10(2)/64. log10(2)/64]); ``` Performance benchmark using perf tool from the CORE-MATH project on Ryzen 1700: ``` $ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh exp10f GNU libc version: 2.35 GNU libc release: stable CORE-MATH reciprocal throughput : 10.215 System LIBC reciprocal throughput : 7.944 LIBC reciprocal throughput : 38.538 LIBC reciprocal throughput : 12.175 (with `-msse4.2` flag) LIBC reciprocal throughput : 9.862 (with `-mfma` flag) $ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh exp10f --latency GNU libc version: 2.35 GNU libc release: stable CORE-MATH latency : 40.744 System LIBC latency : 37.546 BEFORE LIBC latency : 48.989 LIBC latency : 44.486 (with `-msse4.2` flag) LIBC latency : 40.221 (with `-mfma` flag) ``` This patch relies on https://reviews.llvm.org/D134002 Reviewed By: orex, zimmermann6 Differential Revision: https://reviews.llvm.org/D134104