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: [PATCH][4.3] Expand lround inline for x86_64/i?86 SSE math


On Wed, 18 Oct 2006, Andrew Haley wrote:

> Geert Bosch writes:
>  > 
>  > For case of round-to-even and operations that are strictly
>  > IEEE-conformant, you can do replace the 0.5 constant by its
>  > predecessor (which I gave in my previous mail) and the rounding of
>  > the addition will ensure right answers in all cases.
> 
> Mmm, but hold on: lround is explicitly _not_ round-to-even.

Still seems to work.  I.e. we assume the hardware rounds to even
for all operations, then lround can be implemented by

  (long)(x + copysign (nextafter (0.5, 0.0), x))

which would be fine (as we can restrict the inline expansion to
-fno-rounding-math then, which is the default).  Now on to a way
to tell real.c to do nextafter (0.5, 0.0) ...

Richard.

--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs


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