Number of significand bits in long double?
Steve Kargl
sgk at troutmask.apl.washington.edu
Fri Aug 5 18:01:05 GMT 2005
On Fri, Aug 05, 2005 at 11:33:35AM -0600, M. Warner Losh wrote:
> In message: <20050804150405.GA95916 at troutmask.apl.washington.edu>
> Steve Kargl <sgk at troutmask.apl.washington.edu> writes:
> : Can someone confirm or refute that the working number
> : of bits in the significand of long double type is 53
> : on i386?
>
> The number of bits is 53. However, you can get more bits by adding a
> fpsetprec(FP_PE) at the start of the programs. Otherwise, you get
> FP_PD by default. Once you do that, things seem to basically work,
> but I've not run paranoia.c to make sure.
>
I'm writing some of the missing C99 long double math functions
(to be contributes to FreeBSD). The code assumes 64 bits in
the approximations that I'm using. When I try to run test
programs to check the accuracy of my implementations against
GMP/MPFR ouput, I can't trust the values of LDBL_* reported from
float.h. My test programs now include
#ifdef AMD64
#define BITSL 64
#define DIGSL 18
#else
#define BITSL 53
#define DIGSL 15
#endif
instead of #include <float.h> and the use of LDBL_MANT_DIG
and LDBL_DIG.
--
Steve
More information about the freebsd-hackers
mailing list