Decimal Floating Point Arithmetic : Decimal « Data Type « Python






Decimal Floating Point Arithmetic

Decimal Floating Point Arithmetic

from decimal import *       

print Decimal('0.70') * Decimal('1.05')

print .70 * 1.05

Decimal('1.00') % Decimal('.10')
Decimal("0.00")
print 1.00 % 0.10
       
print sum([Decimal('0.1')]*10) == Decimal('1.0')
print sum([0.1]*10) == 1.0



           
       








Related examples in the same category