misc: increase decimal precision (#48513)

This commit is contained in:
Frédéric Péters 2020-11-13 10:04:47 +01:00
parent 02dc092b84
commit b3378e553e
2 changed files with 2 additions and 1 deletions

View File

@ -491,6 +491,7 @@ def test_mathematics_templatetag():
assert tmpl.render({'term1': 0, 'term2': ''}) == '0'
assert tmpl.render({'term1': '', 'term2': 0}) == '0'
assert tmpl.render({'term1': 0, 'term2': 0}) == '0'
assert tmpl.render({'term1': 780, 'term2': 0.000463}) == '0.36114'
# divide
tmpl = Template('{{ term1|divide:term2 }}')

View File

@ -214,7 +214,7 @@ def parse_decimal(value, do_raise=False):
# replace , by . for French users comfort
value = value.replace(',', '.')
try:
return Decimal(value).quantize(Decimal('1.0000')).normalize()
return Decimal(value).quantize(Decimal('1.000000')).normalize()
except (ArithmeticError, TypeError):
if do_raise:
raise