-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-fmtArea: `core::fmt`Area: `core::fmt`C-bugCategory: This is a bug.Category: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
I tried this code:
println!("{:.*e}", 0, 25);
println!("{:.*e}", 0, 25.0);
I expected to see this happen:
The output should be the same regardless if I'm formatting an integer or a float, in this case most likely 3e1
.
Instead, this happened:
3.e1
2e1
Happens in both latest stable and nightly.
EDIT: I'm suspecting this is actually two separate bugs in both the integer and float implementation - the integer result contains a .
which should not be there, and the float gets rounded down to 2
despite 25.1
rounding to 3e1
- which is the result I would expect for 25.0
as well.
moxian, jedel1043, wrazik, raskad and workingjubilee
Metadata
Metadata
Assignees
Labels
A-fmtArea: `core::fmt`Area: `core::fmt`C-bugCategory: This is a bug.Category: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.