import decimal import numpy as np from decimal import * getcontext().prec = 100 tot = Decimal ('0') x = Decimal ('1') y = Decimal ('1') / Decimal (x) / Decimal ('2') tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('1.1') y = Decimal ('1') / Decimal (x) tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('1.2') y = Decimal ('1') / Decimal (x) tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('1.3') y = Decimal ('1') / Decimal (x) tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('1.4') y = Decimal ('1') / Decimal (x) tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('1.5') y = Decimal ('1') / Decimal (x) tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('1.6') y = Decimal ('1') / Decimal (x) tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('1.7') y = Decimal ('1') / Decimal (x) tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('1.8') y = Decimal ('1') / Decimal (x) tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('1.9') y = Decimal ('1') / Decimal (x) tot = Decimal (tot) + Decimal (y) print (x, y) x = Decimal ('2') y = Decimal ('1') / Decimal (x) / Decimal ('2') tot = Decimal (tot) + Decimal (y) print (x, y) tot = Decimal (tot) / Decimal ('10') print (tot) precies = Decimal (np.log (2)) print (precies) fout = Decimal ('100') * (Decimal (tot) / Decimal (precies) - Decimal ('1')) print (fout) term1 = Decimal ('1') / Decimal ('1600') tot = Decimal (tot) - Decimal (term1) print (term1) print (tot) fout = Decimal ('100') * (Decimal (tot) / Decimal (precies) - Decimal ('1')) print (fout) term2 = Decimal ('-1') / Decimal ('1280000') tot = Decimal (tot) - Decimal (term2) print (term2) print (tot) fout = Decimal ('100') * (Decimal (tot) / Decimal (precies) - Decimal ('1')) print (fout)