summaryrefslogtreecommitdiff
path: root/libc/test/src/__support/str_to_float_test.cpp
AgeCommit message (Collapse)Author
2025-06-11[libc] Reduce direct use of errno in src/stdlib and src/__support tests. ↵Alexey Samsonov
(#143767) * Get rid of libc_errno assignments in str_to_* __support tests, since those API have been migrated to return error in a struct instead. * Migrate tests for atof and to strto* functions from <stdlib.h> and for strdup from <string.h> to use ErrnoCheckingTest harness.
2025-03-10[libc] Add `-Wno-sign-conversion` & re-attempt `-Wconversion` (#129811)Vinay Deshmukh
Relates to https://github.com/llvm/llvm-project/issues/119281#issuecomment-2699470459
2025-03-05Revert "[libc] Enable -Wconversion for tests. (#127523)"Augie Fackler
This reverts commit 1e6e845d49a336e9da7ca6c576ec45c0b419b5f6 because it changed the 1st parameter of adjust() to be unsigned, but libc itself calls adjust() with a negative argument in align_backward() in op_generic.h.
2025-03-04[libc] Enable -Wconversion for tests. (#127523)Vinay Deshmukh
Relates to: #119281
2024-11-05[libc][NFC] Correct test header inclusion, license (#114604)Michael Jones
Some tests were including LibcTest.h directly. Instead you should include Test.h which does proper indirection for other test frameworks we support (zxtest, gtest). Also added some license headers to tests that were missing them.
2024-08-09[libc] Fix CFP long double and add tests (#102660)Michael Jones
The previous patch removing the fenv requirement for str to float had an error that got missed due to a lack of tests. This patch fixes the issue and adds tests, as well as updating the existing tests.
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-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.
2023-12-15[libc][NFC] Split str_to_float tests and reduce type clutter (#75471)Guillaume Chatelet
This is a follow up on #75353.
2023-12-11[libc][NFC] Remove custom leading_zeroes, factor in frequent typenames (#74825)Guillaume Chatelet
2023-12-01[libc][NFC] Rename SPECIAL_X86_LONG_DOUBLE in ↵Guillaume Chatelet
LIBC_LONG_DOUBLE_IS_X86_FLOAT80 (#73950)
2023-12-01[libc][NFC] rename LONG_DOUBLE_IS_DOUBLE into LIBC_LONG_DOUBLE_IS_FLOAT64 ↵Guillaume Chatelet
(#73948)
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-03-13[libc][NFC] Switch string and errno tests to libc_errno.Siva Chandra Reddy
2023-02-28[libc] fix strtofloat test with 128 bit floatsMichael Jones
Differential Revision: https://reviews.llvm.org/D144991
2023-02-28[libc] Refactor string to float return valuesMichael Jones
The internal implementation of the string to float function previously used pointer arguments for returning several values. Additionally it set errno in several unexpected places. Now all of that goes through return structs. For readability I also moved the function away from raw pointer arithmetic towards proper indexing. I also added support for rounding modes. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D144597
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-08-25[NFC][libc] Move Uint implementation to parent directoryGuillaume Chatelet
Differential Revision: https://reviews.llvm.org/D132638
2022-06-24[libc] Add Uint128 type as a fallback when __uint128_t is not available.Siva Chandra Reddy
Also, the unused specializations of __int128_t have been removed. Differential Revision: https://reviews.llvm.org/D128304
2022-04-28[libc] Support 32-bit ARM platform testsDominic Chen
Set LONG_DOUBLE_IS_DOUBLE, add ifdefs for 128-bit integer types Differential Revision: https://reviews.llvm.org/D124204
2022-03-08[libc][NFC] remove completed TODOsMichael Jones
There were some "TODO" messages that were for things that I have already completed. This patch removes those. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D121232
2022-02-07[libc] Fix mixed-sign comparison warnings and an out-of-bound access in ↵Tue Ly
high_precision_decimal.h Fix mixed-sign comparison warnings and an out-of-bound access in high_precision_decimal.h Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D119156
2021-12-22[libc] add modified Eisel-Lemire for long doublesMichael Jones
The Eisel-Lemire algorithm is an effecient way to handle converting to floating point numbers from strings, but in its base form it only supports up to 64 bit floating point numbers. This adds an implementation to handle long doubles. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D115280
2021-12-22[libc] apply formatting to testsMichael Jones
Apply the formatting rules that were applied to the libc/src directory to the libc/test directory, as well as the files in libc/utils that are included by the tests. This does not include automated enforcement. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D116127
2021-12-07[libc] apply new lint rulesMichael Jones
This patch applies the lint rules described in the previous patch. There was also a significant amount of effort put into manually fixing things, since all of the templated functions, or structs defined in /spec, were not updated and had to be handled manually. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D114302
2021-11-11[libc] tweak strtof errno behaviorMichael Jones
When strtof/d/ld return a subnormal number they may set errno to ERANGE. This change makes this behavior more consistent by making any decimal number converting to a subnormal set errno to ERANGE. This brings it in line with hexadecimals, which currently only set errno to ERANGE if the number is truncated when converting to a subnormal. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D113626
2021-10-29[libc] add fast path to string to float conversionMichael Jones
Add the fast path first described by Clinger [1] with additions by Gay [2]. This speeds up conversion by about 10% by handling numbers with fewer digits more efficiently. [1] Clinger WD. How to Read Floating Point Numbers Accurately. SIGPLAN Not 1990 Jun;25(6):92–101. https://doi.org/10.1145/93548.93557. [2] Gay DM, Correctly rounded binary-decimal and decimal-binary conversions; 1990. AT&T Bell Laboratories Numerical Analysis Manuscript 90-10. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D112580
2021-10-18[libc] add atof, strtof and strtodMichael Jones
Add the string to floating point conversion functions. Long doubles aren't supported yet, but floats and doubles are. The primary algorithm used is the Eisel-Lemire ParseNumberF64 algorithm, with the Simple Decimal Conversion algorithm as backup. Links for more information on the algorithms: Number Parsing at a Gigabyte per Second, Software: Practice and Experience 51 (8), 2021 (https://arxiv.org/abs/2101.11408) https://nigeltao.github.io/blog/2020/eisel-lemire.html https://nigeltao.github.io/blog/2020/parse-number-f64-simple.html Differential Revision: https://reviews.llvm.org/D109261