For some reason, a decimal object loses precision when multiplied. Therefore, there is no reason. Please check the test and enlighten me.
from decimal import * getcontext().prec = 11 a = Decimal('5085.28725881485') b = 1 print getcontext() print 'a = '+str(a) print 'b = '+str(b) print 'a * b = '+str(a * b)
And the conclusion:
Context(prec=11, rounding=ROUND_HALF_EVEN, Emin=-999999999, Emax=999999999, capitals=1, flags=[], traps=[DivisionByZero, InvalidOperation, Overflow]) a = 5085.28725881485 b = 1 a * b = 5085.2872588
Not sure if this is relevant, but python2.6 is used.
source share