I'm sometimes wondering if a floating point format really needs to have inf, -inf and nan, or if a single "non finite" value capturing all of those would be sufficient
I'm sometimes wondering if a floating point format really needs to have inf, -inf and nan, or if a single "non finite" value capturing all of those would be sufficient
Not at all sufficient. NaN typically means that something has gone wrong—e.g. your precision requirements exceed that of the floating point representation you've selected, you've done a nonsensical operation. inf and -inf might be perfectly acceptable results depending on your application and needs.