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


> Jan Hubicka <jh@suse.cz> writes:
> 
> > 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.
> 
> It's not safe, except for 'abs' and 'neg'.  For example,
> (float)sqrt(2.0 * FLT_MAX) != sqrtf(2.0 * FLT_MAX).
> I think it would be OK for -ffast-math, though.

I am doing only (float)sqrt((double)float)
that commonly results from C code that uses floats but calls math
functions.  I can add fast-math code for weaker checks later, but first
I would like to know whether this transformation is valid.

I will add the comments :)  I usually write the automatically and
ididn't noticed there are none..

Honza
> 
> -- 
> - Geoffrey Keating <geoffk@geoffk.org>


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