From owner-freebsd-standards@FreeBSD.ORG Mon Dec 1 14:57:42 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4B55216A4CE; Mon, 1 Dec 2003 14:57:42 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 13E3243F85; Mon, 1 Dec 2003 14:57:40 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id JAA00601; Tue, 2 Dec 2003 09:57:33 +1100 Date: Tue, 2 Dec 2003 09:57:33 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Steve Kargl In-Reply-To: <20031201203512.GA95524@troutmask.apl.washington.edu> Message-ID: <20031202091936.I8778@gamplex.bde.org> References: <20031129000133.GA30662@troutmask.apl.washington.edu> <20031129163105.GA32651@troutmask.apl.washington.edu> <20031201182219.O4431@gamplex.bde.org> <20031201203512.GA95524@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: David Schultz cc: freebsd-standards@freebsd.org Subject: Re: Implementing C99's roundf(), round(), and roundl() X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2003 22:57:42 -0000 On Mon, 1 Dec 2003, Steve Kargl wrote: > On Mon, Dec 01, 2003 at 07:05:18PM +1100, Bruce Evans wrote: > > All the other corner cases need to be checked. It's possibly to check > > all 2^32 cases for floats (once you know the correct results). > > Do you have code to do this check? > > > Other things to check: setting of exception flags. I'm not sure if the > > settings by ceil() are the right ones and the only ones. I thought of a good way after righting the above: roundf() is supposed to be equivalent to rintf() with certain rounding, so set the rounding mode and call rintf() to determine the correct value. Unfortunately there might not be a correct rounding mode (what does round to nearest do for integers? I think it rounds to even, but roundf() requires rounding up half-way cases). > AFAICT, we can't do the exception handling according to POSIX, because > we don't have , feclearexcept(), and fetestexcept() implemented, > yet. RIght, but we have fpgetsticky(), etc. Bruce