Negative NaN is not a NaN?

后端 未结 6 1406
感情败类
感情败类 2020-12-09 15:43

While writing some test cases, and some of the tests check for the result of a NaN.

I tried using std::isnan but the assert failes:

Asse         


        
6条回答
  •  抹茶落季
    2020-12-09 16:12

    There's C99 isnan() which you should be able to use.

    If in your implementation it does not work correctly (which one is that?) you can implement your own, by reinterpret_casting to long and doing IEEE bit magic.

提交回复
热议问题