This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Converting floor to rint
Jan Hubicka <jh@suse.cz> writes:
|> > Jan Hubicka <jh@suse.cz> writes:
|> >
|> > [...]
|> >
|> > | > [#2] The rint functions differ from the nearbyint functions
|> > | > (7.12.9.3) only in that the rint functions may raise the
|> > | ^^^
|> > | Does this imply that I can implement rint as nearbyint call and never
|> > | cause the exception and always use frndint instruction for it that does
|> > | not trap?
|> >
|> > If FE_INEXACT is on, that is incorrect.
|> But why the standard don't say that rint function will raise the
|> interrupt? I would interpred may as it can behave that way or don't
|> have to.
Yes, rint is the weaker function. The implementation of nearbyint must
make sure that no inexact exception is raised, whereas for rint this is
not necessary. That means that if you have a round instruction that never
raises the exception it can be used to implement both functions.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."