Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Dec 2003 09:57:33 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc:        freebsd-standards@freebsd.org
Subject:   Re: Implementing C99's roundf(), round(), and roundl()
Message-ID:  <20031202091936.I8778@gamplex.bde.org>
In-Reply-To: <20031201203512.GA95524@troutmask.apl.washington.edu>
References:  <20031129000133.GA30662@troutmask.apl.washington.edu> <20031129163105.GA32651@troutmask.apl.washington.edu> <20031201182219.O4431@gamplex.bde.org> <20031201203512.GA95524@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <fenv.h>, feclearexcept(), and fetestexcept() implemented,
> yet.

RIght, but we have fpgetsticky(), etc.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031202091936.I8778>