Skip to content

Apply scientific exponents to the integer mantissa - #124

Open
AshSgDe29071999 wants to merge 1 commit into
valyala:masterfrom
AshSgDe29071999:fix/scientific-notation-rounding
Open

AshSgDe29071999 wants to merge 1 commit into
valyala:masterfrom
AshSgDe29071999:fix/scientific-notation-rounding

Conversation

@AshSgDe29071999

Copy link
Copy Markdown

2.0250405e+07 was parsed as (2.0250405)*1e7, which is not exact in float64 (2.0250404999999996e+07). Combine the fractional digits with the exponent first so the mantissa stays an integer.

Fixes #110

Test

go test ./fastfloat -run 'TestParseSuccess|TestParseBestEffort' -count=1

2.0250405e+07 was parsed as (2.0250405)*1e7, which is not exact in
float64. Combine the fractional digits with the exponent first.

See valyala#110
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.

FastFloat's parsing of scientific notation strings for integers with specific digit counts can lead to precision loss

1 participant