I would like to know, for the following cases, if the IEEE standard guarantees every possible case (excluding NaN and infinities) using any cpu adhering to the standard:
(# means all operations: + - * /)
Commutativity: +
and *
are guaranteed unless either argument is NaN
. -
and /
are not commutative and division by 0.0
gives you +Inf
, -Inf
, or NaN
according to the numerator. Here I'm not giving any consideration to signed zeros.
Associativity. Absolutely not. The addition of two small numbers followed by a large number is a counter-example.
x - x
is 0
unless x
is NaN
, +Inf
, or -Inf
in which case it is NaN
.
x * 0
is 0
unless x
is NaN
, +Inf
, or -Inf
in which case it is NaN
.
x * 1
is x
unless x
is NaN
in which case it is NaN
.
x / x
is 1
unless x is 0.0
, +Inf
, -Inf
, or NaN
in which case it is NaN
.
Note the subtle difference of (5).