>>> s = [.1,.1,.1,.1,.1,.1,.1,.1,.1,.1]<br>>>> sum(s)<br>0.9999999999999999<br><span style="font-family: courier new,monospace;">>>> print(sum(s))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">1.0</span> Why?<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">>>> f = 0.9999999999999999</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">>>> f**100</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">0.9999999999999889</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">>>> print(f**100)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1.0</span> Why?<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">>>> f**10000</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">0.9999999999988898</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">>>> print(f**10000)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">0.999999999999</span> <span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">>>> from math import fsum</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">>>> fsum(s)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">1.0</span><br>>>> from math import fsum<br>>>> fsum(s) <br>1.0 See <<a href="http://docs.python.org/py3k/library/math.html?highlight=fsum#math.fsum">http://docs.python.org/py3k/library/math.html?highlight=fsum#math.fsum</a>><br>
<br>The "Why?"s mark what are puzzles for me.<br><br>I see nothing in the doc for print() that explains these: <<a href="http://docs.python.org/py3k/library/functions.html?highlight=print#print">http://docs.python.org/py3k/library/functions.html?highlight=print#print</a>>, but I'm sure a Tutor can.<br>
<br>Dick Moores<br>