Haskell: comparing NaN values

后端 未结 1 1484
执笔经年
执笔经年 2021-01-23 17:40

I wrote quickcheck tests for a Haskell program that optimizes and evaluates a function.

The problem is quickcheck generates expressions resulting in NaN lik

相关标签:
1条回答
  • 2021-01-23 18:02

    No, as is defined by IEEE 754 comparing 2 NaNs always return false. To chceck if your value is NaN in Haskell you can use isNaN method or write it by yourself

    isNaN' :: a -> Bool
    isNaN' a = a /= a
    
    0 讨论(0)
提交回复
热议问题