title: stof() and stod() precision
body: <p>I'm parsing a file with some numbers. I'm trying to change the numbers from string to float or double, but I found out a precision problem with stof and stod, they are off by slight amount in VS C++. For example</p>
  
  <pre><code>string str1="3.14", str2="45.106";
  double number1, number2;
  number1=stod(str1);
  number2=stof(str2);
  </code></pre>
  
  <p>When I test (number1==3.14), it returns "false".  When I look in debugger, number1 is actually 3.139999999 or something like that! number2 may be 45.1060000002 or something like that.  Any explanation or solution?</p>