- #1
- 2,795
- 21
Two pieces of maths software that I have handle these floating point "special values" differently. One returns +inf and the other returns nan. (For the calculation of +inf - nan).
I can see some logic to both of those answers. I guess in first case it is following a rule that +inf - (anything other than +inf) = +inf (and +inf - +inf = nan). While in the second case I guess it's following the rule that nan (+ - * /) anything = nan.
Does anyone know of any "standard" for dealing with these special FP values that would make one of the above interpretations more correct than the other.
Thanks. :)
I can see some logic to both of those answers. I guess in first case it is following a rule that +inf - (anything other than +inf) = +inf (and +inf - +inf = nan). While in the second case I guess it's following the rule that nan (+ - * /) anything = nan.
Does anyone know of any "standard" for dealing with these special FP values that would make one of the above interpretations more correct than the other.
Thanks. :)