| Thread Links | Date Links | ||||
|---|---|---|---|---|---|
| Thread Prev | Thread Next | Thread Index | Date Prev | Date Next | Date Index |
Scott Ferson wrote:
So, if I understand you correctly,
[-2,3] * [-2,3] should *not *be optimized to [-2,3]**2
Yes.
but
A * A *should *be optimized to A**2.
I think this makes good sense. In the former case, the compiler has no
way to know that the first and second instance of [-2,3] refer to the
same quantity, whereas, in the latter case, the programmer has asserted
that they do by choosing the one variable name.
I'd replace *should* with *may*. But these transformations should be
clearly documented somewhere I think.
I think Arnold's proposal is good in requiring that all real, exact
results have to be enclosed (which would be violated by optimizing
[-2,3] * [-2,3] to [-2,3]**2) and that the user shall be able to turn
off optimizations for parts of his program.
Christian
--
/"\
Christian Keil \ / ASCII Ribbon Campaign
mail:c.keil@xxxxxxxxxxxxx X against HTML email & vCards
/ \