Fix compute of exponent with Decimal value
repr of Decimal is not a valid string for Decimal. issue5097 review16781002
This commit is contained in:
1 parent
887ebe5517
commit
7b91ab8575
1 file changed
+4
-1
@@ -326,7 +326,10 @@ class FloatField(Field):
|
||||
if digits:
|
||||
p = digits[1]
|
||||
else:
|
||||
p = -int(Decimal(repr(value * factor)).as_tuple().exponent)
|
||||
d = value * factor
|
||||
if not isinstance(value, Decimal):
|
||||
d = Decimal(repr(value * factor))
|
||||
p = -int(d.as_tuple().exponent)
|
||||
return locale.format('%.*f', (p, value * factor), True)
|
||||
else:
|
||||
return ''
|
||||
|
||||
Reference in new issue
Block a user