Mail Archives: djgpp/1996/01/31/18:36:22
In article <310DF403 DOT 2EDA7BBD AT alcyone DOT com>, Erik Max Francis <max AT alcyone DOT com> writes:
> Russell Blackadar wrote:
>
> > What is surprising is that all the columns are not zero! The original poster
> > was offering some speculations as to how that might have happened, but as you
> > say (and I think he'd agree) it doesn't wash. I ran his posted code and
> > got all zeroes. Either there's a *serious* problem with his compiler, or the
> > posted code is not the same as what he compiled.
>
> Not at all. Systematic errors are expected when using floating point
> computations.
>
> Under gcc 2.6.3 for Linux, his program prints the following:
Making gcc an ANSI/ISO Standard conforming compiler is trickier than it
seems -- the required options are neither simple nor obvious. This is
particularly true in places like floating point arithmetic where people
are generally less concerned with getting the exactly ``correct''
results (i.e., what the standard says you should get) than they are
with getting reasonably correct results fast.
In particular, the standard generally allows a compiler to compute
floating point results with more precision than it requires, but there
are a number of places where it requires any excess precision to be
removed. gcc generally does not remove the excess precision in those
cases. Specifying -ffloat-store helps; on i386/i486 machines so does
-mno-fp-ret-in-387; but, as far as I can tell, there is no way (as of
gcc 2.7.1) to make gcc conform completely on i386/i486 machines as there
is no way to force it to remove precision as a result of a cast.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070
larry DOT jones AT sdrc DOT com
I like maxims that don't encourage behavior modification. -- Calvin
- Raw text -