Opened 13 years ago
Last modified 13 years ago
#16881 closed Uncategorized
db.backends.util.format_number fails with valid inputs — at Version 1
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
We see the error "quantize result has too many digits for current context" when using a DecimalField with max_digits=7 decimal_places=2 ie the following call fails
format_number(Decimal('914123.22'), 7, 2)
I believe this is due to the statement
context.prec = max_digits
whereas I think it should be
context.prec = max_digits + decimal_places
but I am not sure.
Note:
See TracTickets
for help on using tickets.
Improved formatting.