[PATCH]: transform nearbyint->rint & rint/lrint->round/lround

Richard Guenther richard.guenther@gmail.com
Sat Mar 10 21:20:00 GMT 2007


On 3/10/07, Kaveh R. GHAZI <ghazi@caip.rutgers.edu> wrote:
> This patch adds transformations of the form:
>
> nearbyint -> rint (when -fno-trapping-math)
> rint -> round (when -fno-rounding-math)
> lrint -> lround (also when -fno-rounding-math)

round (0.5) is 1.0 while rint (0.5) is 0.0 - i.e. the round-to-nearest rounding
direction rounds to even while round rounds 0.5 away from zero.
So the latter two transformations are not valid.  Also lrint can be
implemented more efficient than lround for this reason.

Richard.



More information about the Gcc-patches mailing list