Is it a good idea to use IEEE754 floating point NaN for values which are not set?

后端 未结 9 584
粉色の甜心
粉色の甜心 2020-12-18 22:17

Is it a good idea to use IEEE754 floating point NaN (not-a-number) for values which are undefined for non-mathematical reasons?

In our case they are not yet set beca

9条回答
  •  渐次进展
    2020-12-18 22:49

    Using NaN as a default value is reasonable.

    Note that some expressions, such as (0.0 / 0.0), return NaN.

提交回复
热议问题