[Llvm-bgq-discuss] rint() with -ffast-math

Erik Schnetter schnetter at cct.lsu.edu
Wed Jun 19 10:48:53 CDT 2013


On Wed, Jun 19, 2013 at 11:12 AM, Hal Finkel <hfinkel at anl.gov> wrote:

> ----- Original Message -----
> >
> >
> >
> > The function rint() is supposed to round to the nearest integer,
> > breaking ties to even. With -ffast-math, it breaks ties away from
> > zero. That is, in corner cases the result is incorrectly rounded.
> >
> >
> > Is this intended? This (BGQ with Clang) is the first system that does
> > so. (I understand why one would do this given the machine
> > instructions available.)
>
> Yes, this is the intended behavior (and LLVM will currently do this on all
> PPC systems). It is a function of the (odd) way in which the PPC frin
> instruction is defined. The upside is that it is much faster than the libc
> function call. That having been said, I put this optimization in, and I can
> take it out again ;) [or make it require some other flag]. Is the behavior
> too different for you?
>

I can live with this optimization, I just want to know where -ffast-math
has its boundaries...

-erik

-- 
Erik Schnetter <schnetter at cct.lsu.edu>
http://www.perimeterinstitute.ca/personal/eschnetter/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alcf.anl.gov/pipermail/llvm-bgq-discuss/attachments/20130619/a483b1fd/attachment.html>


More information about the llvm-bgq-discuss mailing list