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 impl of floating numbers does not display signaling NaNs #24624

Closed
nagisa opened this issue Apr 20, 2015 · 2 comments
Closed

Debug impl of floating numbers does not display signaling NaNs #24624

nagisa opened this issue Apr 20, 2015 · 2 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@nagisa
Copy link
Member

nagisa commented Apr 20, 2015

use std::mem;

fn main() {
    let signaling_nan: f32 = unsafe {mem::transmute(0x7FC0_0000u32)};
    assert_eq!(format!("{:?}", signaling_nan), "sNaN(00000)");
}

fails with “assertion failed: (left == right) (left: "NaN", right: "sNaN(00000)")”

The actual representation is bikeshedable (could be just “sNaN” etc).

playpen

@steveklabnik
Copy link
Member

steveklabnik commented Jun 27, 2016

Triage: no change

@steveklabnik steveklabnik added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed A-libs labels Mar 24, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 22, 2017
@dtolnay
Copy link
Member

dtolnay commented Nov 17, 2017

This seems okay but I would prefer to see an RFC to justify this a little better. In particular:

  • What use cases is this intended to solve?
  • How do some other languages solve those use cases?
  • Does Debug of a quiet NaN also need to tell us which of the many quiet NaNs it is?
  • (less important) Brainstorm some alternative representations.

@dtolnay dtolnay closed this as completed Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants