Re: Conflicts between C standard and 754-2008
On 2011-01-06 09:08:16 -0800, Stephen Canon wrote:
> Michel is correct that FP addition (or multiplication) may be
> non-commutative in the presence of NaNs -- specifically, if you have
> two NaNs with differing payloads, the result of a*b or a+b my differ
> from that of b*a or b+a. This does not cause a conflict with 754
> either, however.
Well, to be more accurate, about the "non-commutative", it depends
on the level. At the levels 1, 2 and 3, they are commutative, and
as I interpret the IEEE 754 standard, it mentions commutative,
associative and distributive laws at levels 2 and 3 only (not 4):
- Applying the properties of real numbers to floating-point
expressions only when they preserve numerical results and flags
raised:
- Applying the commutative law only to operations, such as
addition and multiplication, for which neither the numerical
values of the results, nor the representations of the results,
depend on the order of the operands.
- Applying the associative or distributive laws only when they
preserve numerical results and flags raised.
- Applying the identity laws (0 + x and 1 × x) only when they
preserve numerical results and flags raised.
while the payload is a level-4 notion. So, I agree that the
non-commutativity concerning the payload does not cause a conflict
with 754.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)