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

Ryu format 3.2 as 0.0 on powerpc64le #47

Closed
NobodyXu opened this issue Apr 22, 2022 · 7 comments
Closed

Ryu format 3.2 as 0.0 on powerpc64le #47

NobodyXu opened this issue Apr 22, 2022 · 7 comments

Comments

@NobodyXu
Copy link

NobodyXu commented Apr 22, 2022

In my PR ParkMyCar/compact_str#16 , when formatting 3.2 using ryu (currently disabled due to bug), it gives me 0.0 on target powerpc64le instead of 3.2 (it works on all other target).

P.S. formatting using std on the target gives me 0

@dtolnay
Copy link
Owner

dtolnay commented Apr 22, 2022

If std::fmt is formatting it as 0 as well, I would propose that this is unlikely to be a bug in this crate.

Once whatever is broken in std or rustc has been fixed, if ryu is still incorrect after that, please follow up.

@dtolnay dtolnay closed this as completed Apr 22, 2022
@NobodyXu
Copy link
Author

Sure.

@NobodyXu
Copy link
Author

NobodyXu commented May 5, 2022

@dtolnay Please reopen this as the nightly rustc has fixed the error formatting 3.2_f32 as 0.0, but ryu still format it as 0.0 according to this CI log, though it can format f64 correctly.

@dtolnay
Copy link
Owner

dtolnay commented May 6, 2022

What was the fix?

@NobodyXu
Copy link
Author

NobodyXu commented May 7, 2022

What was the fix?

We didn't fix the code, somehow after updating nightly, the bug is fixed, but ryu still format 3.2_f32 as 0.0, but format the f64 correctly.

I also discovered a minor bug in std format, f32::NEG_INFINITY is formatted as "inf" instead of "-inf".

@dtolnay
Copy link
Owner

dtolnay commented May 15, 2022

If it randomly goes away without any relevant code changes in std's formatting code, I am still extremely skeptical that it would need a code change in ryu's formatting code as opposed to the bug being elsewhere.

@NobodyXu
Copy link
Author

If it randomly goes away without any relevant code changes in std's formatting code, I am still extremely skeptical that it would need a code change in ryu's formatting code as opposed to the bug being elsewhere.

Yeah, it looks like a bug in generating the assembly in rustc or llvm.

Repository owner locked and limited conversation to collaborators May 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants