title: Setprecision is Confusing
body: <p>I just want to ask about setprecision because I'm a bit confused. </p>
  
  <p>here's the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  using namespace std;
  
  int main()
  
  {
    double rate = x;
    cout &lt;&lt; fixed &lt;&lt; setprecision(2) &lt;&lt; rate;
  }
  </code></pre>
  
  <p>where x = to following:</p>
  
  <p>the left side of equation are the values of x.</p>
  
  <p>1.105 = 1.10 should be 1.11</p>
  
  <p>1.115 = 1.11 should be 1.12</p>
  
  <p>1.125 = 1.12 should be 1.13</p>
  
  <p>1.135 = 1.14 which is correct</p>
  
  <p>1.145 = 1.15 also correct </p>
  
  <p>but if x is:</p>
  
  <p>2.115 = 2.12 which is correct</p>
  
  <p>2.125 = 2.12 should be 2.13</p>
  
  <p>so why in a certain value it's correct but sometimes it's wrong?</p>
  
  <p>please enlighten me. thanks</p>