title: Can -ffast-math be safely used on a typical project?
body: <p>While answering a question where I suggested <code>-ffast-math</code>, a comment pointed out that it is dangerous.</p>
  
  <p>My personal feeling is that outside scientific calculations, it is OK. I also asume that serious financial applications use fixed point instead of floating point.</p>
  
  <p>Of course if you want to use it in your project the ultimate answer is to test it on your project and see how much it affects it. But I think a general answer can be given by people who tried and have experience with such optimizations: </p>
  
  <p><strong>Can <code>ffast-math</code> be used safely on a <em>normal</em> project?</strong></p>
  
  <p>Given that IEEE 754 floating point has rounding errors, the assumption is that you are already living with inexact calculations.</p>
  
  <hr>
  
  <p><a href="https://stackoverflow.com/a/22135559/2805305">This answer</a> was particular illuminating on the fact that <code>-ffast-math</code> does much more than reordering operations that would result in a slightly different result (does not check for NaN or zero, disables signed zero just to name a few), but I fail to see what the effects of these would ultimately be in a <em>real</em> code.</p>
  
  <hr>
  
  <p>I tried to think of <em>typical</em> uses of floating points, and this is what I came up with:</p>
  
  <ul>
  <li>GUI (2D, 3D, physics engine, animations)</li>
  <li>automation (e.g. car electronics)</li>
  <li>robotics</li>
  <li>industrial measurements (e.g. voltage)</li>
  </ul>
  
  <p>and school projects, but those don't really matter here.</p>