ladybird/Tests/AK
davidot 53b7f5e6a1 AK: Add an exact and fast floating point parsing algorithm
This is based on the paper by Daniel Lemire called
"Number parsing at a Gigabyte per second", currently available at
https://arxiv.org/abs/2101.11408
An implementation can be found at
https://github.com/fastfloat/fast_float

To support both strtod like methods and String::to_double we have two
different APIs. The parse_first_floating_point gives back both the
result, next character to read and the error/out of range status.
Out of range here means we rounded to infinity 0.

The other API, parse_floating_point_completely, will return a floating
point only if the given character range contains just the floating point
and nothing else. This can be much faster as we can skip actually
computing the value if we notice we did not parse the whole range.

Both of these APIs support a very lenient format to be usable in as many
places as possible. Also it does not check for "named" values like
"nan", "inf", "NAN" etc. Because this can be different for every usage.

For integers and small values this new method is not faster and often
even a tiny bit slower than the current strtod implementation. However
the strtod implementation is wrong for a lot of values and has a much
less predictable running time.

For correctness this method was tested against known string -> double
datasets from https://github.com/nigeltao/parse-number-fxx-test-data
This method gives 100% accuracy.
The old strtod gave an incorrect value in over 50% of the numbers
tested.
2022-10-23 15:48:45 +02:00
..
CMakeLists.txt AK: Add an exact and fast floating point parsing algorithm 2022-10-23 15:48:45 +02:00
TestAllOf.cpp AK+Everywhere: Stop including Vector.h from StringView.h 2021-11-10 21:58:58 +01:00
TestAnyOf.cpp AK+Everywhere: Stop including Vector.h from StringView.h 2021-11-10 21:58:58 +01:00
TestArbitrarySizedEnum.cpp AK: Add an ArbitrarySizedEnum template 2022-03-27 18:54:56 +02:00
TestArray.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestAtomic.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestBadge.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestBase64.cpp Tests: Convert TestBase64 decode test to use StringViews directly 2022-07-12 23:11:35 +02:00
TestBinaryHeap.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestBinarySearch.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestBitCast.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestBitmap.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestBuiltinWrappers.cpp AK: Add BuiltinWrappers.h 2021-12-18 23:36:08 +01:00
TestByteBuffer.cpp Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr 2022-01-24 22:36:09 +01:00
TestCharacterTypes.cpp Tests: Reduce runtime of TestCharacterTypes 2021-06-24 09:16:28 +02:00
TestChecked.cpp Tests: Add tests for Checked<T>::div() overflow 2021-05-07 09:26:11 +02:00
TestCircularDeque.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestCircularDuplexStream.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestCircularQueue.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestComplex.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestDisjointChunks.cpp Tests: Test DisjointChunks with FixedArray 2022-02-27 00:11:14 +03:30
TestDistinctNumeric.cpp Everywhere: Prefix 'TYPEDEF_DISTINCT_NUMERIC_GENERAL' with 'AK_' 2022-07-22 23:09:43 +01:00
TestDoublyLinkedList.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestEndian.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestEnumBits.cpp AK/Tests: Add test for EnumBits has_any_flag() 2021-07-16 11:49:50 +02:00
TestFind.cpp Tests: Remove unused header includes 2021-08-01 08:10:16 +02:00
TestFixedArray.cpp AK+Tests: Don't double-destroy NoAllocationGuard in TestFixedArray 2022-09-15 23:04:46 +00:00
TestFixedPoint.cpp AK: Add FixedPoint base 2 logarithm 2022-02-28 13:59:31 +01:00
TestFloatingPoint.cpp AK: Add FloatingPoint.h 2022-08-27 12:28:05 +02:00
TestFloatingPointParsing.cpp AK: Add an exact and fast floating point parsing algorithm 2022-10-23 15:48:45 +02:00
TestFormat.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
TestGenericLexer.cpp AK: Add GenericLexer API to consume an escaped Unicode code point 2021-08-19 23:49:25 +02:00
TestHashFunctions.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestHashMap.cpp AK: Clear the previous and next pointers of deleted HashTable buckets 2022-06-22 21:53:13 +02:00
TestHashTable.cpp AK: Zero previous pointer *after* fixing the insertion list in HashTable 2022-06-23 20:25:12 +03:00
TestHex.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestIndexSequence.cpp AK+Everywhere: Stop including Vector.h from StringView.h 2021-11-10 21:58:58 +01:00
TestIntegerMath.cpp AK: Introduce IntegralMath.h starting with pow<I> 2022-02-06 17:52:33 +00:00
TestIntrusiveList.cpp AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00
TestIntrusiveRedBlackTree.cpp AK+Kernel: Reduce the number of template parameters of IntrusiveRBTree 2021-09-10 18:05:46 +03:00
TestIPv4Address.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
TestIPv6Address.cpp AK: Add IPv6Address class 2022-03-08 23:05:44 +01:00
TestJSON.cpp AK: Allow exponents in JSON double values 2022-09-02 02:07:37 +01:00
TestLEB128.cpp AK: Handle LEB128 encoded values that are too large for the result type 2021-05-31 14:25:27 +04:30
TestLexicalPath.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
TestMACAddress.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
TestMemory.cpp AK: Use the correct data types in bitap_bitwise() 2022-07-14 13:10:23 +02:00
TestMemoryStream.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestNeverDestroyed.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestNonnullRefPtr.cpp Tests: Fix compile errors on Clang 2021-07-14 13:12:25 +02:00
TestNumberFormat.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestOptional.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
TestPrint.cpp AK: Allow printing wide characters using %ls modifier 2022-03-30 11:30:43 +04:30
TestQueue.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestQuickSort.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestRedBlackTree.cpp AK: Clear minimum when removing last node of RedBlackTree 2022-02-10 14:09:39 +00:00
TestRefPtr.cpp AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00
TestSinglyLinkedList.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestSourceGenerator.cpp Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
TestSourceLocation.cpp Everywhere: Explicitly specify the size in StringView constructors 2022-07-12 23:11:35 +02:00
TestSpan.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestStack.cpp AK: Implement AK::Stack 2021-05-26 16:36:53 +04:30
TestStdLibExtras.cpp Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
TestString.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
TestStringUtils.cpp AK: Do not append string bytes as code points when title-casing a string 2022-10-20 18:55:43 +02:00
TestStringView.cpp Tests: Remove StringView char const* initialization test 2022-07-12 23:11:35 +02:00
TestTime.cpp AK: Add Time::is_negative() to detect negative time values 2021-08-15 12:20:38 +02:00
TestTrie.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
TestTuple.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestTypedTransfer.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestTypeTraits.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TestUFixedBigInt.cpp AK: Make truncating UFixedBigInts constexpr 2022-10-23 15:48:45 +02:00
TestURL.cpp AK: Fix bad parsing of some file:/// URLs with base URL 2022-09-20 15:38:53 +02:00
TestUtf8.cpp AK+Tests: Avoid creating invalid code points from malformed UTF-8 2022-10-09 10:37:20 -06:00
TestUtf16.cpp Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
TestVariant.cpp AK: Make Variant::visit() prefer overloads accepting T const& over T& 2022-01-14 11:35:40 +03:30
TestVector.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
TestWeakPtr.cpp AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00