title: Looking for faster method of doing this double function
body: <p>I am looking to speed up a function that maps one double number to another double number.  However the function must remain the same.  Same same input must produce exactly the same output as before.  The reason for this is we don't want to introduce any differences into the system, even if this original function has questionable  behavior.</p>
  
  <p>Function is:</p>
  
  <pre><code>double g(double d)
  {
          std::stringstream ss;
          ss.precision(10);
          ss&lt;&lt;std::fixed&lt;&lt;d;
          std::string asString;
          ss &gt;&gt; asString;
          return atof(asString.c_str());
  }
  </code></pre>
  
  <p>Function looks pretty slow.  Converting a double to another double by going through strings looks odd.  </p>