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

Implement format instructions #35

Closed
paupino opened this issue Aug 21, 2017 · 0 comments
Closed

Implement format instructions #35

paupino opened this issue Aug 21, 2017 · 0 comments

Comments

@paupino
Copy link
Owner

paupino commented Aug 21, 2017

The following code:

let a = Decimal::new(100, 2);
let b = Decimal::new(300, 2);
let c = a / b;
println!("{}", c);
println!("{:.2}", c);

produces the output:

0.3333333333333333333333333333
0.

This is because the implementation converts to a string first and applies the pad method. Decimal should implement further format instructions to support producing 2dp without requiring rounding first up.

@jekirl jekirl mentioned this issue Oct 5, 2017
@paupino paupino closed this as completed in 18ea93f Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant