Re: Expression evaluation
On May 18 2011, Michel Hack wrote:
I paid special attention to the definition of "reproducible" mode
in 754-2008, trying to avoid the most unreasonable requirements that
were on the table at various points.
And, by and large, you succeeded. Some of those were completely off
the wall. In its final form, it is at least implementable for SOME
conventional languages, even if not the main ones!
Current language standards notwithstanding, there has to be some common
understanding of explicit evaluation order control, otherwise many
constructs such as TWO_SUM (exact sum or product into a sum of standard
floaters) could not be expressed.
That is definitely true. There are really three levels of expression:
Ordinary numeric expressions.
Ones that are arithmetically sensitive.
Ones that play games with the bits or NaNs.
There are good grounds not to constrain the first (the vast majority).
My view is that the last should always be done by special functions, for
locatability if nothing else. The problem is the one in the middle.
On any given platform the compiler
documentation can state rules that allow the constructs to be trusted,
and in practice that tends to be good enough.
For non-portable code, yes :-( Unfortunately, that is NOT how either
most users or many (most?) proponents view the situation, which leads
to unreliable code with all sides claiming that it is the others that
are broken!
Regards,
Nick Maclaren.