Date: Sat, 29 Nov 2003 15:50:21 -0800 (PST) From: Stefan Farfeleder <stefan@fafoe.narf.at> To: freebsd-standards@FreeBSD.org Subject: Re: standards/59797: Implement C99's round[f]() math fucntions Message-ID: <200311292350.hATNoLLa044621@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/59797; it has been noted by GNATS. From: Stefan Farfeleder <stefan@fafoe.narf.at> To: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu> Cc: bug-followup@FreeBSD.org Subject: Re: standards/59797: Implement C99's round[f]() math fucntions Date: Sun, 30 Nov 2003 00:40:04 +0100 On Sat, Nov 29, 2003 at 10:06:27AM -0800, Steven G. Kargl wrote: > >Synopsis: Implement C99's round[f]() math fucntions Nice! > +double round(double x) { > + double t; > + if (x >= 0.0) { > + t = ceil(x); > + if (t - x > 0.5) t -= 1.0; > + return t; > + } else { > + t = ceil(-x); > + if (t + x > 0.5) t -= 1.0; > + return -t; > + } > +} One suggestion: Could you make that +double +round(double x) +{ to match style(9) and (most of) msun/src/*.c? Cheers, Stefan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311292350.hATNoLLa044621>