Should -fcross-jumping be part of -O1?

Scott Robert Ladd coyote@coyotegulch.com
Thu Dec 4 13:51:00 GMT 2003


Gabriel Dos Reis wrote:
> Sure it is.  If the result falls into the predicted interval, and
> therefore the expected decision is made based on that then then the
> computation is correct.

All calculations involve a certain level of uncertainty, whether done on 
paper or in silicon. Alas, far too many programmers fail to understand 
basic mathematical principles.

Of course, we also live in a world where someone can enter a value in 
newtons into a program expecting metric units, thus dooming expensive 
spacecraft. In many ways, complexities with computer math arise more 
from human perceptions than from technical considerations.

> There is a whole branch of mathematical approach to numerics based on
> interval aritmetic upon which on can base sofwtare construction with
> predictable results -- as far as the compiler implementer does not go
> his way of playing language lawyering non-sense.  Have a look for
> example how interval airthmetic are used in computation geometry
> (http://www.cgal.org/ being the most popular), or in CAGD where it is
> quite important to get the correct topological structrure of shapes.
> In such context, algorithms are most of the time based on combination
> of numeric and symbolic computation and it is far more important to
> get a (numeric) computation correct than to get it fast.

Exactly. Interval arithmetic is an excellent tool. It's implemented by 
specialized tools like MatLab, Maple, and Mathematica, and through 
libraries for Lisp and C++. Here's a good collection of resources for 
those who aren't familiar with the topic:

     http://www.cs.utep.edu/interval-comp/main.html

Some effort has been made toward integrating interval mathematics into 
GCC, as per the following paper:

     http://home.ku.edu.tr/~ahakkas/publications/comp-supp.pdf

> I don't time left, and I'm not quite interested in distractive
> language lawyering game. But I feel it is really misleading to
> outright reject (correctness, predictability which together imply)
> reproducibility. 

I tend to agree; there exist trade-offs based on the limitations of 
hardware and software, but I find more errors in mathematics from people 
who do not understand basic concepts like rounding and significant 
digits. An absolutely correct result that takes too long to calculate 
(say, in a real-time system) is no better than an instant answer that is 
wrong (in any system).

Rather than seeking a generic answer, perhaps a better approach is for 
someone (me?) to document how GCC options affect accuracy and speed, to 
educate those who care abotu such matters? A practical guide might be 
useful, even though a number of academic papers exist on the subject.

Hmmm... I need to think about this some more.

..Scott

-- 
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
Software Invention for High-Performance Computing




More information about the Gcc mailing list