fork download
  1. #!/usr/bin/env python
  2. finish = 2.0
  3. d = finish / 2
  4. f = d
  5. for i in range(0, 54):
  6. s = "%.17g" % d
  7. assert float(s) == d
  8. print(s)
  9. f /= 2
  10. d += f
  11.  
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
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