-
-
Notifications
You must be signed in to change notification settings - Fork 129
Test Stream::parseFloat() with many input digits #133
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
129ae52
Test Stream::parseFloat() with many digits
edgar-bonet 8eb4013
Use Approx() macro for fuzzy comparison
edgar-bonet 5445db3
Test Stream::parseFloat() with a large number
edgar-bonet fae13e5
Exchanging the type of 'value' from 'long' to 'double' prevents overf…
aentinger 1266b08
Replacing computational expensive pow call with result of accumulated…
aentinger 91c5e29
Test Stream::parseFloat() with a huge number of digits
edgar-bonet 6197511
Avoid overflowing parseFloat()'s internal 'value'
edgar-bonet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value
may overflow toINFINITY
on AVR if there are more than 38 digits (maybe that's so many we do not care about that case?), event with a number smaller thanFLT_MAX
. I suggest instead:Note that on something other than AVR one would need more than 308 digits to demonstrate the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this form, however in that case we've got to commit to using a
double
forvalue
. I personally would not mind since we are talking about stream parsing after all and the onlyStream
channels currently available are Serial and various networking streams and which are slow even compared to floating point multiplication.I can further support my argument pro floating point implementation that if you want to run performance-critical/floating-point applications on an 8-Bit architecture you've selected the wrong MCU alltogether.
@facchinm / @cmaglie what's your take on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I got no feedback over quite a long period of time (unfortunate but not unexpected given what we are currently swamped in) I'm moving forward with merging this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's hold on for a second though @edgar-bonet can you integrate your last change suggested above by yourself:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aentinger: OK, I'll do it today.