On 2013-11-05 07:10:33 -0800, Richard Fateman wrote:
On 11/4/2013 5:44 PM, Jean-Pierre Merlet wrote:
I think that by default the compiler should take the expression
"as it" and provides simplification only on demand.
The compiler should follow the semantics of the language.
Allowed optimizations with depend on that.
I think we cannot depend on a language implementation ignoring
optimization settings etc. Thus some systems will 'optimize'
x-x to 0. So we cannot advocate writing x-x, at least if the answer
matters!
Systems don't blindly "optimize" x-x to 0 (unless x is necessarily
a number). An interval isn't a number. 0 isn't an interval.
Optimizing x-x to 0 when x is an interval is an error.
Note: If in some language, x represents a number but the evaluation
is done with interval arithmetic, then compiler could be allowed to
optimize x-x to 0, but that's out of the scope of P1788, because the
optimization (or simplification) is done before interval arithmetic
comes into play.