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]: transform nearbyint->rint & rint/lrint->round/lround


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.


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