【发布时间】:2011-06-14 13:12:32
【问题描述】:
考虑下面的代码
let a = 5. / 0.
let b = sin a
let c = sqrt(-5.)
它同时产生 Infinity 和 NaN。在这两种情况下,我都希望抛出异常(出于调试目的)。
我使用 Visual Studio 2010。我将 Debug/Exceptions.../Common Language Runtime Exceptions/System/System.ArithmeticException 设置为“Thrown”,但是在运行代码时,没有抛出异常。
知道为什么以及如何在 NaN 或 Infinity 上引发异常吗?
【问题讨论】:
标签: .net exception f# nan infinity