isnan(), isinf() 直到 C99 才出现在规范中,无论如何在 C89 中实现这样的功能?
isnan(), isinf()
我可以if (d * 0 != 0)用来检查 d 是 NaN 还是 Inf,但我们总是使用选项编译我们的项目,该选项-Werror=float-equal想大喊:error: no == or != on float point value
if (d * 0 != 0)
-Werror=float-equal
error: no == or != on float point value
那么人们如何在 C89 中检查 nan 和 inf 呢?
c floating-point c99 nan c89
c ×1
c89 ×1
c99 ×1
floating-point ×1
nan ×1