Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Mar 2008 21:18:30 -0800
From:      Colin Percival <cperciva@freebsd.org>
To:        Colin Percival <cperciva@FreeBSD.ORG>, Bruce Evans <brde@optusnet.com.au>,  Bruce Evans <bde@FreeBSD.ORG>, src-committers@FreeBSD.ORG, cvs-src@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/i386/include _types.h
Message-ID:  <47CF7EA6.90802@freebsd.org>
In-Reply-To: <20080306033807.GB47280@zim.MIT.EDU>
References:  <200803051121.m25BLE03035426@repoman.freebsd.org> <47CE8396.6020803@freebsd.org> <20080306095645.V7605@delplex.bde.org> <47CF5AE8.2090101@freebsd.org> <20080306033807.GB47280@zim.MIT.EDU>

next in thread | previous in thread | raw e-mail | index | archive | help
David Schultz wrote:
> If gcc actually implemented IEEE 754R / C99 / LIA1 correctly, then
> when compiling something like 'double x = y' would require it to
> store the value to memory and then reload it to force it to 53-bit
> precision.

Even this wouldn't work, since it would result in double rounding.

> The whole point of double_t is to allow the programmer
> to ask for a variable that is "at least double precision", so that
> the compiler isn't forced to clip everything to double precision
> if it's inefficient to do so.

Right -- and that's why numerical analysts should use double (after
proving that their code will produce the correct results using
double-precision arithmetic) while people who don't understand
floating-point math should always use double_t.

> However, gcc doesn't compile the above
> expression correctly, and FreeBSD works around the problem by
> setting the default rounding mode to 53 bits, which is why it's
> pointless to increase the size of double_t.

I disagee with your characterization of setting the rounding mode
as a "workaround", but your conclusion is correct: At the moment,
increasing the size of double_t is pointless.

Colin Percival




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