Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Expression evaluation



Nick Maclaren wrote:
> ...      754 has been the de facto standard for a couple of decades,
> and I don't know of ANY language that supports it in full, or even
> supports most of it at all well.  And the semantic problems are a
> major part of the reason why not.

One class of languages that does is assemblers, if the platform's
primitives are compliant.  If the Principles of Operation of the
platform are well-defined the semantic issue is resolved.  Support
is rarely complete, but can come close by augmenting the instruction
set with macros or idioms that provide the completion.  Conversions
to and from strings tend to require library functions, but those can
be fully conforming, with no semantic issues.

Of course, few are in a position to take advantage of this.  Compiler
writers could do so however, if they had clear directions from the
programmer as to what the intent is -- and this is an area where I
believe that progress is possible.

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.  My interpretation of the result
is that it addresses implementations more than language standards, but
that languages are encouraged to provide ways to declare the programmer's
intent, without encumbering the language's normal way of doing things.
This could include pragmas, syntactically redundant parentheses, or
similar means, as would fit the language.

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.  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.

Michel.
---Sent: 2011-05-18 17:44:58 UTC