title: How do I force the C# compiler to throw an exception when any math operation produces 'NaN'?
body: <p>Some math functions in a program I recently wrote are returning unacceptable values, such as NaN (possibly due to not checking some function's input params). The problem is that it's being quite difficult to track down which functions are passing the wrong values. This results in errors being propagated throughout the code and making the program crash minutes or hours later, if at all.</p>
  
  <p>I wonder if there's a way to catch these faulty operations the moment a NaN value results from any operation (pretty much the same as in the 'DivisionByZero exception' thrown by some C/C++ compilers, if I remember).</p>
  
  <p>Thanks in advance.</p>
  
  <p>P.D: Please feel free to re-tag my question if needed.</p>