1

this Wikipedia article did not address this contingency and i am having trouble finding a definitive IEEE-754 document that addresses this.

1

1 Answer 1

4

The implication of the line

x - x = x + (-x) = +0,   ! (for any finite x, −0 when rounding toward negative)

would seem to be that you should get +0.

4
  • "or -0 when rounding toward negative." I would take that literally.
    – Doc Brown
    May 15, 2018 at 3:36
  • the funny thing is, even rounding down, that would imply a non-negative number getting rounded down to a negative number. that seems very weird. May 16, 2018 at 22:13
  • i wonder what the rationale is for this -0 resulting if the rounding mode is set to always rounding down. May 16, 2018 at 22:15
  • @robertbristow-johnson: Usually, it won't be a problem. By far, the most common system that has both +0 and -0 is 1's complement. 1's complement has the interesting characteristic that it always truncates toward zero: it might truncate to +0 or -0, but it always truncates toward zero. 2's complement, on the other hand, always truncates toward -INFINITY, and this can cause problems in certain signal processing algorithms. (You do not want to know how I learned this.) Jun 5, 2021 at 5:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.