title: The behaviour of floating point division by zero
body: <p>Consider</p>
  
  <pre><code>#include &lt;iostream&gt;
  int main()
  {
      double a = 1.0 / 0;
      double b = -1.0 / 0;
      double c = 0.0 / 0;
      std::cout &lt;&lt; a &lt;&lt; b &lt;&lt; c; // to stop compilers from optimising out the code.    
  }
  </code></pre>
  
  <p>I have always thought that <code>a</code> will be +Inf, <code>b</code> will be -Inf, and <code>c</code> will be NaN. But I also hear rumours that strictly speaking the behaviour of floating point division by zero is <em>undefined</em> and therefore the above code cannot considered to be portable C++. (That theoretically obliterates the integrity of my million line plus code stack. Oops.)</p>
  
  <p>Who's correct?</p>
  
  <p>Note I'm happy with <em>implementation defined</em>, but I'm talking about cat-eating, demon-sneezing <em>undefined behaviour</em> here.</p>