Default Exception Handling

Posted by Beetle B. on Wed 06 February 2019

Invalid

The default result of such an operation is a quiet NaN.

The operations that lead to Invalid are:

  • Most operations on a signaling NaN
  • \(0\times\infty\) or \(\infty\times0\)
  • An FMA of the form \(\FMA(0,\infty,x)\), unless \(x\) is a quiet NaN, in which case whether the exception is signaled is up to the implementation.
  • \((-\infty)+\infty\) or \(\infty-\infty\)
  • FMAs that lead to subtraction of infinities of the same sign
  • \(0/0\) or \(\infty/\infty\)
  • \(\REM(x,0)\) where \(x\) is not a NaN
  • \(\REM(\infty,y)\) where \(y\) is not a NaN
  • \(\sqrt{x}\) where \(x<0\)
  • Converting a floating point number \(x\) to an integer where \(x\) is outside the range of integers, or is NaN or infinity
  • Certain types of comparisons (did not note the details)
  • \(\logB(x)\) where \(x\) is NaN or \(\infty\)
  • \(\logB(0)\) where the output format of \(\logB\) is an integer format (as opposed to a floating point format). Division By Zero

This was discussed earlier. Overflow An overflow occurs when the absolute value of the rounded value of the intermediate result (calculated with unbounded exponent range) is finite, and larger than the largest floating point number.

Depending on the rounding mode. The results are as you’d expect - I’m not going to list them all. The only catch is with round to nearest. Round to nearest will return \(\pm\infty\) as long as it is greater than \(\Omega+\frac{1}{2}\ulp(\Omega)\).

Round towards zero will give you \(\pm\Omega\), but getting that result does not guarantee an overflow. If your value is larger than \(\Omega\), but less than \(\beta^{e_{max}}\), then you don’t get an overflow even though the result is \(\Omega\). Underflow Underflow is when you have a nonzero result whose magnitude is strictly smaller than the smallest normal number.

This was already covered in a previous section.

If the result is exact, then the underflow flag is not raised.