Skip to content

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

Closed
@sanmai-NL

Description

@sanmai-NL

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

Activity

varkor

varkor commented on Jan 18, 2018

@varkor
Member

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

dtolnay commented on Jan 21, 2018

@dtolnay
Member

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

sanmai-NL

sanmai-NL commented on Jan 30, 2018

@sanmai-NL
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dtolnay@sanmai-NL@varkor

        Issue actions

          `Debug` formatting floating point number does not (always) include decimal separator · Issue #47536 · rust-lang/rust