.NET doubles and decimals don’t throw DivideByZeroException

I ran into this today on some code that divided one input by another but didn’t check for a zero divisor. When I passed the result to DateTime.AddDays(double), it returned an unexpected ArgumentOutOfRangeException. After reproducing this in a unit test, it turns out that dividing a double or decimal by zero returns NaN instead of an exception. This is so the type is consistent with IEEE 754.