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 II


> > On Wed, Nov 06, 2002 at 06:54:41PM +0100, Jan Hubicka wrote:
> > > +      For fast math it would be safe probably to convert (float)sqrt(x)
> > 	(double)((float)a + (float)b)
> > 
> > where A = B = 2**127.  The result should be +Inf, not 2**128.
> 
> I am doing that only when the mode of + is wider.
> > 
> > Finally, I think it is alarmingly incorrect that
> > 
> > 	(float)((double)a + (double)b))
> > 
> > does not result in a quantity of type float, as requested.
> 
> Here I do that.  When a and b are floats, I will produce
> (a+b)
> is that wrong?

I see, you were shooting for something like
(float)((long double)a + (long double)b)
for a and b being double.  That will result in (a+b) not casted to float
that is wrong.  I am adding recursive call to convert_to_real when this
ahppends.

Honza
> 
> Honza
> > 
> > 
> > r~


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