Computation with Floating Point Numbers: When to Round? <p>I'm performing some computations in C with floating point numbers. I'm specifically dealing with the case where I get the lowest possible single precision value for the exponent. </p> <p>Say my exponent is -126 and I have to decrement it. In this case, I can't go any lower, so I need to right shift my mantissa once. I know I'm supposed to get the exact answer for a calculation and <em>then</em> round (to whatever place is specified). </p> <p>I'm thinking of doing (let <code>M</code> be the mantissa):</p> <pre><code>M &gt;&gt;= 1; //round mantissa </code></pre> <ol> <li><p>since I'm shifting the mantissa to the right and there was an implied 1 to the left of the floating point, do I need to modify M after shifting with something like:</p> <pre><code>M |= (1 &lt;&lt; 23) </code></pre> <p>to ensure I have a 1 in the most significant bit?</p></li> <li><p>It seems weird to round after losing a bit of information but is this standard / accepted practice? Or should I calculate the full result by using more bits and <em>then</em> rounding?</p></li> </ol>