Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Aug 2005 10:48:36 -0700
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Number of significand bits in long double?
Message-ID:  <20050805174836.GA4906@troutmask.apl.washington.edu>
In-Reply-To: <20050805.113335.27815012.imp@bsdimp.com>
References:  <20050804150405.GA95916@troutmask.apl.washington.edu> <20050805.113335.27815012.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 05, 2005 at 11:33:35AM -0600, M. Warner Losh wrote:
> In message: <20050804150405.GA95916@troutmask.apl.washington.edu>
>             Steve Kargl <sgk@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



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