This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Simplify floating point conversions


> On Tue, Nov 05, 2002 at 06:14:00PM +0100, Jan Hubicka wrote:
> > Hi,
> > this patch makes us to simplify some of the floating point operations to
> > narrower mode when conversions are present.  This include
> > +,-,/,*,abs,neg,sqrt/sin/cos/exp.
> > I believe it is IEEE safe, but some expert would be welcome.
> 
> You should have commented this.  It should not take someone 5
Oops...
> minutes to even figure out what's going on here.  To be sure, it's
> 
> 	(float)sqrtl(x)   ->  sqrtf((float)x)

It does just (float)sqrt((float)x)->sqrtf(x)

This is common in C code when you call sqrt on float value.

Honza
> 
> correct?  Well, clearly this fails for X = 2**(127 * 2), since
> X is not representable as a float, but its square root is.  It
> would not be hard to identify similar problems with every other
> operation on your list except for ABS/NEG.
> 
> 
> r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]