-
Notifications
You must be signed in to change notification settings - Fork 57
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
Implement more formatting traits #1
Comments
Added impls for the various fmt traits: Octal, LowerHex, UpperHex, Binary, LowerExp, UpperExp Also added tests for those impls. Closes rust-num#1
I'm not entirely sure what these formatting traits should do, as they seem to have been designed with only integers in mind. Would they format as decimals? fractions?
The same questions apply to After writing the above table, I'm convinced we should use fractions, as otherwise we'll have infinite repeating decimals all over the place, and we would have to decide how to truncate them. I'm torn between mixed and improper fractions though. There is an argument to be made for mixed fractions, as in the case of a Ratio where the denominator is 1, it necessarily reduces to the integer behavior described in the trait (we could choose to not display denominators of 1 for both fraction methods). Both would be easy to implement, it's just about what users want/expect. Do they want 10000/3 or do they want 3333 + 1/3? |
We implement FWIW, the current implementation of |
I would be happy to submit a PR for this issue, but maybe I'll wait until my other PRs get through. I want to make sure I see those through. |
LowerExp
,UpperExp
,Binary
,Octal
,LowerHex
, andUpperHex
are all reasonable, where the underlying type already implements them.cc rust-num/num#259
The text was updated successfully, but these errors were encountered: