Fix compute exponent when value is int and factor Decimal
Some Numeric Function field return integer instead of Decimal, so the test to convert to Decimal should be on the result of the factor multiplication instead of the value. issue5106 review16791003
This commit is contained in:
1 parent
9092ead1fa
commit
8ebaad2cb5
1 file changed
+2
-2
@@ -327,8 +327,8 @@ class FloatField(Field):
|
||||
p = digits[1]
|
||||
else:
|
||||
d = value * factor
|
||||
if not isinstance(value, Decimal):
|
||||
d = Decimal(repr(value * factor))
|
||||
if not isinstance(d, Decimal):
|
||||
d = Decimal(repr(d))
|
||||
p = -int(d.as_tuple().exponent)
|
||||
return locale.format('%.*f', (p, value * factor), True)
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user