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

Debug formatting floating point number does not (always) include decimal separator #47536

Closed
sanmai-NL opened this issue Jan 18, 2018 · 3 comments

Comments

@sanmai-NL
Copy link

In order to keep optimal equivalence between a Debug formatted representation of values and Rust source code, it would be helpful if e.g. f64 values are formatted including their decimal separator by default. This avoids having to adjust a whole lot of f64 fields in some larger structure when e.q. writing an equivalence assertion of such a value based on earlier Debug output. Currently, the values are formatted as integers when they are representable as integers.

Meta

rustc 1.25.0-nightly (79a521bb9 2018-01-15)
binary: rustc
commit-hash: 79a521bb9a8ace1a6663578a4c409906adde620d
commit-date: 2018-01-15
host: x86_64-unknown-linux-gnu
release: 1.25.0-nightly
LLVM version: 4.0
@varkor
Copy link
Member

varkor commented Jan 18, 2018

This seems to be the current behaviour as of 3e98f18. Are you sure you weren't using Display instead, or an older version of the compiler?

@dtolnay
Copy link
Member

dtolnay commented Jan 21, 2018

Thanks! This has been fixed as of #46831 and will be released in Rust 1.24.0.

@dtolnay dtolnay closed this as completed Jan 21, 2018
@sanmai-NL
Copy link
Author

@varkor: Yeah, I was using an older version of the compiler (different toolchain).

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

No branches or pull requests

3 participants