title: Is there a floating point literal suffix in C++ to make a number double precision?
body: <p>I'm currently working on a C++ project which does numerical calculations. The vast, vast majority of the code uses single precision floating point values and works perfectly fine with that. Because of this I use compiler flags to make basic floating point literals single precision instead of the double precision, which is the default. I find that this makes expressions easier to read and I don't have to worry about forgetting a 'f' somewhere. However, every now and then I need the extra precision offered by double precision calculations and my question is how I can get a double precision literal into such an expression. Every way I've tried so far first store the value in a single precision variable and the converts the truncated value to a double precision value. Not what I want.</p>
  
  <p>Some ways I've tried so far is given below.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  
  int main()
  {
    std::cout &lt;&lt; sizeof(1.0E200) &lt;&lt; std::endl;
    std::cout &lt;&lt; 1.0E200 &lt;&lt; std::endl;
  
    std::cout &lt;&lt; sizeof(1.0E200L) &lt;&lt; std::endl;
    std::cout &lt;&lt; 1.0E200L &lt;&lt; std::endl;
  
    std::cout &lt;&lt; sizeof(double(1.0E200)) &lt;&lt; std::endl;
    std::cout &lt;&lt; double(1.0E200) &lt;&lt; std::endl;
  
    std::cout &lt;&lt; sizeof(static_cast&lt;double&gt;(1.0E200)) &lt;&lt; std::endl;
    std::cout &lt;&lt; static_cast&lt;double&gt;(1.0E200) &lt;&lt; std::endl;
  
    return 0;
  }
  </code></pre>
  
  <p>A run with single precision constants give the following results.</p>
  
  <pre><code>~/path$ g++ test.cpp -fsingle-precision-constant &amp;&amp; ./a.out
  test.cpp:6:3: warning: floating constant exceeds range of ‘float’ [-Woverflow]
  test.cpp:7:3: warning: floating constant exceeds range of ‘float’ [-Woverflow]
  test.cpp:12:3: warning: floating constant exceeds range of ‘float’ [-Woverflow]
  test.cpp:13:3: warning: floating constant exceeds range of ‘float’ [-Woverflow]
  test.cpp:15:3: warning: floating constant exceeds range of ‘float’ [-Woverflow]
  test.cpp:16:3: warning: floating constant exceeds range of ‘float’ [-Woverflow]
  4
  inf
  16
  1e+200
  8
  inf
  8
  inf
  </code></pre>
  
  <p>It is my understanding that the 8 bytes provided by the last two cases should be enough to hold 1.0E200, a theory supported by the following output, where the same program is compiled without -fsingle-precision-constant.</p>
  
  <pre><code>~/path$ g++ test.cpp  &amp;&amp; ./a.out
  8
  1e+200
  16
  1e+200
  8
  1e+200
  8
  1e+200
  </code></pre>
  
  <p>A possible workaround suggested by the above examples is to use quadruple precision floating point literals everywhere I originally intended to use double precision, and cast to double precision whenever required by libraries and such. However, this feels a bit wasteful.</p>
  
  <p>What else can I do?</p>