On 2009-09-13 06:14:02 -0400, Don <nos...@nospam.com> said:
double foo() {
return x() + y();
}
x() and y() can use whichever rounding modes they like, and if they are
impure, they can affect one another, but under this proposal, they
cannot change the meaning of the addition inside foo().
Problems still may occur if x and y do memoization however. You call
x() with one rounding mode, it memoize the results, then call x() with
another rounding mode and it reuses the previous results while it
shouldn't.
Basicaly, any memoization of x() should be discarded when you change
the rounding mode. For instance the compiler should not reuse the value
of x(), even if x is pure, in the following code:
auto a = x();
setRoundingMode(...);
auto b = x();
Basically, setRoundingMode should act as some sort of barrier for the
optimizer, but how?
--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/