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

Re: Motion 52 -- Time to revive the "Expression" subgroup?



On 2013-11-19 16:30:56 -0800, Richard Fateman wrote:
> On 11/19/2013 4:14 PM, Kreinovich, Vladik wrote:
> >x-x is a good example when an optimizing compiler improves the range obtained by using straightforward interval computations. Alas, there are other cases when an optimizing compilers, while simplifying the expression, make the resulting estimate worse. An example I teach to my students is 1/(1+a/b). This is a perfect Single-Use Expression for which straightforward interval computations produces the exact range.
> >
> >However, this expression requires two division and one addition, so a good optimizing compiler will transform it into an easier-to-compute equivalent expression b/(a+b) which needs 1 addition and only 1 division.
> 
> This would not happen if the expression given to the compiler was something
> like
> interval_division(1, interval_add(1, interval_division(a,b)))

In the context where a and b are of interval type, interval_*
operations are part of the "standard library" associated with
the language, and the compiler is aware of these points, then

  1/(1+a/b)

and

  interval_division(1, interval_add(1, interval_division(a,b)))

could lead to the same code generated by the compiler. Thus
using function names instead of operators like + and / doesn't
necessarily solve problems.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)