[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(- 1.0 1.0) => 0 ; not +0.0 ?



As a thought, I can't help wonder if it may be worth considering
defining that the difference between equivalently valued inexacts
is 0 not +0.0, as although one could argue that their difference
may not be an exact 0, their difference is certainly not warranted
to be positive; thereby avoiding the following very incorrect result:

 (/ (- 1.0e30 (+ 1.0e30 +1))) => +inf.0 ; vs. -1 correctly
 (/ (- 1.0e30 (+ 1.0e30 -1))) => +inf.0 ; vs. +1 correctly

where the reciprocal of 0 is defined as being NaN, as opposed to generating
an otherwise needless and useless error, thereby enabling an arguably less
incorrect NaN result for the above.

(correspondingly as -0.0 and +0.0 are more correctly thought of as being
the negative and positive reciprocals of inf.0 respectively, the difference
between equivalently signed 0.0's should be 0 as well, as their difference
is certainly not correctly warranted to be positive either.)

Thereby:

 (+ -0.0 -0.0) => -0.0
 (+ +0.0 +0.0) => +0.0

 (+ -0.0 +0.0) => 0 ; not +0.0
 (+ -1.0 +1.0) => 0 ; not +0.0

 (/ (- 1.0 1.0)) => NaN ; not +inf.0

etc.