-
Notifications
You must be signed in to change notification settings - Fork 413
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
GSoC 2016: Correct real write bug #3870
Conversation
@mppf seems like the natural reviewer here, if he hasn't been made aware of this one already. |
Hi @Panzone - nice work on this change. I ran the full test suite for you and found the following errors:
I can send outputs if you're unable to reproduce them locally. |
The code change itself looks good to me. Those failing tests probably just need .good updates but you'll need to double-check that the new output makes sense. Also, I'd like to see a new test that verifies some integers of different sizes print as expected (varying the number of digits in the integer). |
Corrected the failing tests and added a new one. |
d = 1000.0 | ||
e = 10000.0 | ||
f = 1.00000e+05 | ||
g = 1e+06 |
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.
Why does f print out with 1.00000e+05 and not 1+05 ? Can you get it to print the simpler version?
It looks good to me, other than the issue I noted. In particular, using the default format (e.g. with writeln) I don't expect it to print digits after the trailing zeros in exponential notation. Still, we're close... |
It should now print the simpler version. This code
now produces
|
Passed full local testing. |
Correct real write bug (from #3870) [cherry-pick]
fix I/O bug in _ftoa_core to solve issue 17170 Resolves #17170 PR #3870 added some code to `_ftoa_core` that examines and updates the output. But, it did not correctly handle the case that not all of the output was present (in particular when there was not enough room left in the current buffer) or when `snprintf` returned an error. This PR updates the existing conditional to check that the `snprintf` was successful. (Note that if `snprintf` returned `buf_sz` that would actually indicate not enough room in the output because `snprintf` would store the trailing `\0` byte instead of the expected output as the last character). Adds a test that reproduces the error so we can avoid it in the future. - [x] full local testing Reviewed by @ben-albrecht - thanks!
This pull request tries to correct the bug noticed in #2148. It will switch to an exponential notation if the standard precision isn't enough to print the decimal part of the number.
Passed test/io and test/release on both linux64 and darwin with default settings.