#!/usr/bin/env python finish = 2.0 d = finish / 2 f = d for i in range(0, 54): s = "%.17g" % d assert float(s) == d print(s) f /= 2 d += f
Standard input is empty
1 1.5 1.75 1.875 1.9375 1.96875 1.984375 1.9921875 1.99609375 1.998046875 1.9990234375 1.99951171875 1.999755859375 1.9998779296875 1.99993896484375 1.999969482421875 1.9999847412109375 1.9999923706054688 1.9999961853027344 1.9999980926513672 1.9999990463256836 1.9999995231628418 1.9999997615814209 1.9999998807907104 1.9999999403953552 1.9999999701976776 1.9999999850988388 1.9999999925494194 1.9999999962747097 1.9999999981373549 1.9999999990686774 1.9999999995343387 1.9999999997671694 1.9999999998835847 1.9999999999417923 1.9999999999708962 1.9999999999854481 1.999999999992724 1.999999999996362 1.999999999998181 1.9999999999990905 1.9999999999995453 1.9999999999997726 1.9999999999998863 1.9999999999999432 1.9999999999999716 1.9999999999999858 1.9999999999999929 1.9999999999999964 1.9999999999999982 1.9999999999999991 1.9999999999999996 1.9999999999999998 2