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: Converting floor to rint


> On Wed, Nov 06, 2002 at 11:29:22PM +0100, Jan Hubicka wrote:
> > On the related note.  How bad would you consider converting
> > floor(x) into rint(x-0.5) in the fast-math mode?
> 
> Well, let's see...
> 
> If the current rounding mode is FE_UPWARD, then
> 
> 	rint(1.7 - 0.5) = rint(1.2) = 2.0
> 
> I.e.  we'd be computing CEIL instead of FLOOR.
> 
> If the current rounding mode is FE_TONEAREST, which is the case
> I assume you were thinking about, we round ties to even, so
> 
> 	rint(5.0 - 0.5) = rint(4.5) = 4.0
> 
> instead of the expected value 5.0.
> 
> So, I think this would be a very bad idea, even for -ffast-math.
Hmmm... OK then :(

Honza
> 
> 
> 
> r~


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