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

Make Debug include the - in -0.0 #24379

Merged
merged 1 commit into from
Apr 15, 2015
Merged

Conversation

hanna-kruppe
Copy link
Contributor

Fixes #20596 by making Debug render negative zero with a - without affecting the behavior of Display.

While I was at it, I also removed some dead code from float_to_str_bytes_common (the one from libcore/fmt/float.rs, not the function of the same name in libstd/num/strconv.rs). It had support for different bases, and for negative numbers, but the function is internal to core and the couple places that call it (all in libcore/fmt/mod.rs) never use those features: They pass in num.abs() and base 10.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@alexcrichton
Copy link
Member

@bors: r+ 219f61b

Thanks!

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Apr 14, 2015
Fixes rust-lang#20596 by making `Debug` render negative zero with a `-` without affecting the behavior of `Display`.

While I was at it, I also removed some dead code from `float_to_str_bytes_common` (the one from `libcore/fmt/float.rs`, not the function of the same name in `libstd/num/strconv.rs`). It had support for different bases, and for negative numbers, but the function is internal to core and the couple places that call it (all in `libcore/fmt/mod.rs`) never use those features: They pass in `num.abs()` and base 10.
@bors bors merged commit 219f61b into rust-lang:master Apr 15, 2015
@hanna-kruppe hanna-kruppe deleted the fmt-negative-zero branch April 25, 2015 20:59
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.

Serialization of float minus zero should include the minus sign.
5 participants