#!/usr/bin/env python # coding: utf-8 # # Rounding problem # In[23]: a=1E-11 b=11000 c=-a-b # Right result # In[24]: 1.0001*a+(b+c) # ### Wrong result! # In[25]: 1.0001*a+b+c # #### Fix de problem: # In[26]: from decimal import Decimal float(Decimal(1.0001*a)+Decimal(b)+Decimal(c)) # In[ ]: