standards/59797: Implement C99's round[f]() math fucntions
David Schultz
das at FreeBSD.ORG
Mon Jun 7 22:10:34 GMT 2004
On Sun, Jun 06, 2004, Steven G. Kargl wrote:
> I would have to go back and review the PR for all the discussion,
> but I thought bde had proposed using rint(3) with an appropriate
> rounding mode. Anyway, whatever you decide to do is fine with
> me.
I found that setting the rounding mode and calling rint(3) is
significantly slower on x87, and that's not counting the special
handling for the halfway cases. The bit-fiddling approach is a
little bit faster than yours (I compared against ceil()), but it's
much harder to maintain. Consider that rintf() still has bugs,
and it has been around for over a decade!
> I looked at the glibc implementation of round(). It does
> bit twiddling, but I would definitely recommend not using
> the glibc version because of licensing and possible copyright
> infringement concerns [hiint compare glibc's round() with
> fdlibm's ceil()].
Hmmm...the glibc implementation does indeed appear to be
plagiarized. Perhaps someone should let the glibc folks know.
More information about the freebsd-standards
mailing list