title: tcl floating-point numbers handling
body: <p>I am just starting to learn TCL. On its <a href="https://www.tcl.tk/man/tcl8.5/tutorial/Tcl6a.html" rel="nofollow noreferrer">Tutorial page</a>, there is a part of description as the following:</p>
  
  <blockquote>
    <p>1.2 / 0.1 results in 11.999999999999998, not 12. That is an example of a very nasty aspect of most computers and programming languages today: <strong>they do not work with ordinary decimal fractions, but with binary fractions. So, 0.5 can be represented exactly, but 0.1 can not.</strong></p>
  </blockquote>
  
  <p>I don't know what exactly this means. I have tried the followings:</p>
  
  <pre><code>% expr {1.2 / 0.1}
  11.999999999999998
  % expr {1.2 / 0.5}
  2.4
  % expr {1.2 / 0.4}
  2.9999999999999996
  % expr {1.2 / 0.3}
  4.0
  </code></pre>
  
  <p>Like it describes, 1.2 / 0.5 will give the exact answer. But with 0.1 as divisor, it won't.</p>
  
  <p>Could anyone kindly explain what the mechanism is here? Thanks.</p>