title: MatLab - 9.45 representation and round
body: <pre><code>&gt;&gt; a = 12.5 * 9.45
  
  a =
  
       1.181250000000000e+02
  
  &gt;&gt; round(a * 100) /100
  
  ans =
  
       1.181200000000000e+02
  </code></pre>
  
  <p>The rounded value should be 118.13, not 118.12.</p>
  
  <p>If you type 9.45 in MatLab command line, it can't be represented : </p>
  
  <pre><code>&gt;&gt; 9.45
  
  ans =
  
     9.449999999999999
  </code></pre>
  
  <p>If I set the numeric format to short, the final result is the same.</p>
  
  <pre><code>&gt;&gt; a = 12.5 * 9.45
  
  a =
  
    118.1250
  
  &gt;&gt; round(a * 100) / 100
  
  ans =
  
    118.1200
  </code></pre>
  
  <p>Can someone explain that? Any workaround?</p>