Ryu-like String to Float Parsing (#138)
A limited implementation for up to 17-digit numbers.
See #129.
* Move some d2s intrinsics to d2s_intrinsics.h
* Rudimentary string to double parsing
* Implement more pieces for parsing
- parse exponents
- parse dot
- handle negative exponents
- handle rounding
- add some basic tests for these things
* Fix constants
* Use __builtin_clzll
Thanks to expnkx for finding this.
See #133.
* Allow exponent to start with '+'
* Correctly handle mantissa overflow
* Increase the table size
Denormal numbers require a larger table because the decimal exponent can go down to -326 (we're using the table inversely to how it's originally used for shortest).
* Handle most overflow/underflow situations
* Increase table size some more
* More tests close to the underflow
These are almost exactly halfway between 0 and the smallest representable float.
* Implement error handling
Mention the restrictions on the input, and that this implementation is experimental.
* Add another caveat to the documentation
* Make it compile with -DRYU_ONLY_64_BIT_OPS
This mode was not defining mulShift. We just use the same implementation as if it's not set.
* Use _BitScanReverse64 on Windows
* Rename mulShift to mulShift{32,64}
Since I moved the mulShift implementations to d2s_intrinsics, they conflict with the ones defined in f2s.c. This is only an issue when -DRYU_OPTIMIZE_SIZE is set, but I think it's better to disambiguate anyway.
* Rename max to max32 to avoid name conflicts on MSVC
* MSVC: Always use _BitScanReverse64
The HAS_64_BIT_INTRINSICS macro is false if RYU_ONLY_64_BIT_OPS is set, so using that is incorrect. Instead, only check for _MSC_VER. I can't seem to find a macro to check for existence of __builtin_clzll. U
Ulf Adams committed
d4114cedf9de3a9504e0fc21e212ef1043af64c7
Parent: 2978dfe
Committed by GitHub <noreply@github.com>
on 12/4/2019, 2:28:49 PM