Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ryu-like String to Float Parsing #138

Merged
merged 20 commits into from
Dec 4, 2019
Merged

Ryu-like String to Float Parsing #138

merged 20 commits into from
Dec 4, 2019

Conversation

ulfjack
Copy link
Owner

@ulfjack ulfjack commented Dec 4, 2019

A limited implementation for up to 17-digit numbers.

See #129.

- parse exponents
- parse dot
- handle negative exponents
- handle rounding
- add some basic tests for these things
Thanks to expnkx for finding this.

See #133.
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).
These are almost exactly half way between 0 and the smallest representable float.
Also mention the restrictions on the input, and that this implementation is experimental.
This mode was not defining mulShift. We just use the same implementation as if it it's not set.
Not sure if this works.
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.
I can't seem to find any documentation on what exactly _BitScanReverse64 returns, and I can only test it on CI.
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.
@ulfjack ulfjack merged commit d4114ce into master Dec 4, 2019
@ulfjack ulfjack deleted the parsing branch August 24, 2020 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant