-
Notifications
You must be signed in to change notification settings - Fork 146
fix issue that integer 1000001 is written as 1000000 #410
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
Conversation
|
it seems we could just early-return for int values instead, right? That would be cleaner. |
I do try to return early, but it fails at case where the -0 is printed as 0 with the '-" sign ignore. |
85dc7b6 to
526ef82
Compare
|
@emilio Hi emilio, would you please review my comment and see if other feedback for the PR? |
emilio
left a comment
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.
Looks good, thanks! I'll land the suggested clean-ups in a follow-up PR.
|
|
||
| let notation = if value == 0.0 && value.is_sign_negative() { | ||
| // Negative zero. Work around #20596. | ||
| dest.write_str("-0")?; |
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 return Ok(()); here
| scientific: false, | ||
| } | ||
| } else if let Some(int_val) = int_value { | ||
| write!(dest, "{}", int_val)?; |
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 return Ok(()) here.
| dtoa_short::write(dest, value)? | ||
| }; | ||
|
|
||
| if int_value.is_none() && value.fract() == 0. && !notation.decimal_point && !notation.scientific |
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.
Then int_value.is_none() can be dropped
|
#421 is the follow-up. |
No description provided.