how do I make a portable isnan/isinf function

前端 未结 11 1493
遇见更好的自我
遇见更好的自我 2020-11-29 06:02

I\'ve been using isinf, isnan functions on Linux platforms which worked perfectly. But this didn\'t work on OS-X, so I decided to use std::is

11条回答
  •  旧巷少年郎
    2020-11-29 06:16

    isnan is part of C++11 now, included in GCC++ I believe, and Apple LLVM.

    Now MSVC++ has an _isnan function in .

    Appropriate #defines and #includes should make a suitable workaround.

    However, I recommend preventing nan from ever occurring, instead of nan detection.

提交回复
热议问题