Opened 14 years ago
Closed 14 years ago
#13810 closed Bug (fixed)
number format routine improvement
Reported by: | milosu | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | david.danier@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
in nuberformat format(), decimal_pos == 0 should effectively remove the decimal part and decimal_pos < len(dec_part) should truncate the decimal part. patch attached.
Attachments (2)
Change History (7)
by , 14 years ago
Attachment: | number_format.patch added |
---|
by , 14 years ago
Attachment: | number_format_r13401.patch added |
---|
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Cc: | added |
---|
comment:3 by , 14 years ago
Component: | Uncategorized → Core (Other) |
---|---|
Severity: | → Normal |
Type: | → Bug |
Note:
See TracTickets
for help on using tickets.
The truncate part is already there, but the condition was incorrect, so I just fixed that instead of adding more checks. Also, added a test. Currently format() allows negative
decimal_pos
(which means, print N positions less than you would normally). I don't really have a use case for that, but I see no harm in allowing it.