-
Notifications
You must be signed in to change notification settings - Fork 564
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
Preserve '.0' when Displaying Number #919
Conversation
src/number.rs
Outdated
N::PosInt(u) => Display::fmt(&u, formatter), | ||
N::NegInt(i) => Display::fmt(&i, formatter), | ||
N::Float(f) => Display::fmt(&f, formatter), | ||
// Preserve `.0` on integral values, which Display hides | ||
N::Float(f) => Debug::fmt(&f, formatter), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we should just serialize using ryu
and itoa
, like the Serializer does, or maybe even go through the Serializer itself. std::fmt
produces a worse representation for floats, like 120000000000000000000000000000000000000000
instead of 1.2e41
.
shouldn't this be a more significant version bump than patch? it has broken a unit test of mine. nothing extreme but was not expecting to see this behavior change |
rustaceans are afraid of MAJOR semvar version changes. it's like kryptonite to them. |
Could this be configurable? I have a slightly unusual use case where I need to represent ones' complement integer, i.e., signed integers with a negative zero. I'm using |
@alteous it looks like you could configure some things through the |
@iitalics that looks promising, thanks! I'll give it a try. |
Tiny followup to #918.
Previously:
1
Now:
1.0