atom feed15 messages in org.freebsd.freebsd-standardsstandards/59797: Implement C99's roun...
FromSent OnAttachments
Steven G. KarglDec 9, 2003 8:43 pm 
Steven G. KarglDec 9, 2003 8:50 pm 
Steven G. KarglDec 10, 2003 9:12 am 
Steven G. KarglDec 10, 2003 9:20 am 
David SchultzJun 4, 2004 7:53 pm 
David SchultzJun 4, 2004 8:00 pm 
David SchultzJun 5, 2004 3:49 pm 
David SchultzJun 5, 2004 3:50 pm 
Steven G. KarglJun 7, 2004 1:28 am 
Steven G. KarglJun 7, 2004 1:30 am 
Steven G. KarglJun 7, 2004 1:33 am 
Steven G. KarglJun 7, 2004 1:39 am 
David SchultzJun 7, 2004 8:11 am 
David SchultzJun 7, 2004 10:10 pm 
David SchultzJun 7, 2004 10:20 pm 
Subject:standards/59797: Implement C99's round[f]() math fucntions
From:David Schultz (da@FreeBSD.ORG)
Date:Jun 7, 2004 10:20:00 pm
List:org.freebsd.freebsd-standards

The following reply was made to PR standards/59797; it has been noted by GNATS.

From: David Schultz <da@FreeBSD.ORG> To: "Steven G. Kargl" <kar@troutmask.apl.washington.edu> Cc: Free@FreeBSD.ORG, free@FreeBSD.ORG Subject: Re: standards/59797: Implement C99's round[f]() math fucntions Date: Sun, 6 Jun 2004 23:38:43 -0700

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.