[Haskell-cafe] Exception for NaN
andrewcoppin at btinternet.com
Thu May 12 21:22:24 CEST 2011
On 12/05/2011 06:14 PM, Grigory Sarnitskiy wrote:
> How do I make my program stop whenever it gets somewhere NaN as a result during a calculation? If there is no appropriate flag for ghc maybe there exist flags for C to use in optc.
> I don't want NaN to propagate, it is merely stupid, it should be terminated.
There is an isNaN function somewhere. You could make a newtype over
Double which performs an isNaN after every operations and throws an
exception if necessary...
More information about the Haskell-Cafe