title: Recommended settings for floating-point contraction in C, C++, and Fortran
body: <p>The C standard (and C++: <a href="http://eel.is/c++draft/expr#pre-6" rel="nofollow noreferrer">[expr.7.1.6]</a>, and <a href="https://www.fortran.com/F77_std/rjcnf0001-sh-6.html#sh-6.6.4" rel="nofollow noreferrer">Fortran</a>), states:</p>
  
  <blockquote>
    <p>The values of the floating operands and the results of floating expressions may be represented in greater precision and range than that required by the type; the types are not changed thereby.</p>
  </blockquote>
  
  <p>Some compilers use greater precisions for the results of floating-point expressions by default (GCC, MSVC), and some compilers do not (Clang), but most of them (not all) are standard conforming and provide a way to control the floating-point contraction behavior. </p>
  
  <p>I write programs that do a lot of floating-point arithmetic. </p>
  
  <p>Is there a general recommendation about whether one should enable or disable contraction by default? Or should I decide this on a case-by-case basis? If so, what should I weight as arguments in favor or against enabling contraction by default for a whole application ?</p>
  
  <hr>
  
  <p>This other answer (<a href="https://stackoverflow.com/questions/49278125/is-floating-point-expression-contraction-allowed-in-c">Is floating point expression contraction allowed in C++?</a>) explains what contraction is, and what the standard rules are, but offers no advice about how to use it. I have experienced both some advantages (e.g. faster performance) and some disadvantages (e.g. super hard to debug bugs) of contraction, but would like to know if there is community consensus about what's the recommended thing to do by default, or if this is one of those things that should be decided on a case-by-case basis (and if that's the case, how do I decide this beforehand?).</p>