On Wed, 16 Feb 2005, Chris Lattner wrote:
>
> > The compiler CANNOT do that FP math simplification "right" (where "right"
> > means "same as if it didn't simplify"). End of story.
> 
> Note that your example isn't a conformant C99 program unless you use the 
> "#pragma STDC FENV_ACCESS" pragma, to tell the compiler that you're 
> messing with rounding modes.
> 
> http://www.iyonix.com/tools/c99pragmas.shtml
> 
> Given conformant programs and a correct compiler, the things you're 
> claiming are impossible are quite possible.  That said, those two 
> assumptions are hard to satisfy these days. :)

I stand by my claim.

The compiler can _avoid_ doing any FP simplification at all. But the 
compiler ABSOLUTELY CANNOT do FP math simplification and still give the 
same result as run-time would. It's one of either: "don't simplify 
constants" or "simplify constants and perhaps get it wrong".

See my argument? In neither case is it a case of "add complex software 
calculation routines". It's an "either do, or do not".

What you can do is have a notion of "exact", of course. "2.0*0.5" can
always be simplified, simply because they are exactly representable
regardless of rounding modes. You don't actually need to have any SW Fp
for that, though, since the HW FP itself will obviously be perfectly fine
for this case.

You'd need to have the host architecture able to handle FE_INEXACT etc, of 
course. And trust your "ascii-to-fp" routine to do the right thing. I 
still maintain that the number of people that really care is starting to 
be infinitesimal.

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to