title: How to tweak std::stod (string to double) for decimal separator and number of digits
body: <p>is there a way to tweak std::stod() in order to increase the number of decimal digits in the (string to double) conversion and to force it to use the US locale?</p>
  
  <p>I have a Qt application that can be run in both console or gui mode:</p>
  
  <pre><code>if (opt-&gt;getFlag( 'c' ) || opt-&gt;getFlag( "console" ) ){
    ThreadManager  modelMainThread;
    modelMainThread.runFromConsole(inputFileName,scenarioName);
  }
  else {
    QApplication app(argc, argv);
    MainWindow mainWin;
    mainWin.show();
    return app.exec();
  }
  </code></pre>
  
  <p>Within this application I have a string to double method that wraps the new C++11 stod:</p>
  
  <pre><code>double s2d ( const string &amp;string_h) const {
    try {
      return stod(string_h);
    } catch (...) {
      if (string_h == "") return 0;
      else {
        cout &lt;&lt; "error!" &lt;&lt; endl;
      }
    }
    return 0;
  }
  </code></pre>
  
  <p>Odd enough, while in the console mode the string to double conversion expects a string with dot as decimal separator, in the gui mode it instead expects a string with comma.
  Furthermore, as I was previously using istringstream:</p>
  
  <pre><code>istringstream totalSString( valueAsString );
  totalSString &gt;&gt; valueAsDouble;
  </code></pre>
  
  <p>I noticed that stod truncates the resulting double to just 3 decimal digits, much less than istringstream.</p>
  
  <p>So is there a way to increase the number of decimal digits and to force std::stod to use the US locale for the conversion ?</p>
  
  <p>Thanks :-)</p>
  
  <p><strong>EDITED</strong>:</p>
  
  <p>If I try this script: </p>
  
  <pre><code>// testing stod() ..
  vector&lt;string&gt; numbers;
  numbers.push_back("123.1234567890");
  numbers.push_back("123.1234");
  numbers.push_back("123,1234567890");
  numbers.push_back("123,1234");
  double outd;
  for(uint i=0;i&lt;numbers.size();i++){
      try {
          outd =  stod(numbers[i]);
          cout &lt;&lt; "Conversion passed: " &lt;&lt; numbers[i] &lt;&lt; "  -  " &lt;&lt; outd &lt;&lt; endl;
      } catch (...) {
          cout &lt;&lt; "Conversion DID NOT passed: " &lt;&lt; numbers[i] &lt;&lt; "  -  " &lt;&lt;endl;
      }
  }
  </code></pre>
  
  <p>I got these results:</p>
  
  <p>"console" mode:</p>
  
  <pre><code>Conversion passed: 123.1234567890  -  123.123
  Conversion passed: 123.1234  -  123.123
  Conversion passed: 123,1234567890  -  123
  Conversion passed: 123,1234  -  123
  </code></pre>
  
  <p>"gui" mode:</p>
  
  <pre><code>Conversion passed: 123.1234567890  -  123
  Conversion passed: 123.1234  -  123
  Conversion passed: 123,1234567890  -  123.123
  Conversion passed: 123,1234  -  123.123
  </code></pre>
  
  <p>So clearly there is something influencing stod() behaviour !</p>