Why a double multiplies a float returns a double in C++ (VS)
<p>Edit(Third time):
Responding to the answers so far, let me clear something:</p>

<ul>
<li>@Lưu Vĩnh Phúc  as he acutely pointed out, in my original expression, </li>
</ul>

<blockquote>
  <p>the precision of an arithmetic operation is decided by the precision
  of the less precise operand.</p>
</blockquote>

<p>I should use accuracy instead of precision. I.e.</p>

<blockquote>
  <p>the accuracy of an arithmetic operation is decided by the accuracy
  of the less accurate operand.</p>
</blockquote>

<p>YES, I accidentally used precision instead of accuracy, and continued to use it in many of my argument. I apologize for my stupid mistake and corresponding confusion. </p>

<p>So the question is restated:</p>

<p>For example:</p>

<pre><code>auto test=100. *3.f;
</code></pre>

<p>Then, the variable test is of double type.</p>

<p>I am puzzled by this choice. Because mathematically speaking, the accuracy of an arithmetic operation is decided by the accuracy of the less accurate operand. In our case, 3.f has already been unable to guarantee its accuracy after at most 8 digits, what's the point of storing test as a double with a possibly misleading impression of 15-digit precision?</p>

<p>My guess is it is possibly related to the exponent, but in this case, the result is 300 which doesn't fall out of the range of float. Or is there any historical reason?</p>

<p>Many thanks,</p>

<hr>

<p>I apologize again for my stupidity.</p>

<hr>

<p>To summarize the answers so far:
1, yes, it's about range; 
2, when double*float->double, there is a lot of truncation. </p>