Number of significand bits in long double?

Steve Kargl sgk at troutmask.apl.washington.edu
Thu Aug 4 19:30:46 GMT 2005


On Fri, Aug 05, 2005 at 05:15:47AM +1000, Peter Jeremy wrote:
> On Thu, 2005-Aug-04 09:26:18 -0700, Steve Kargl wrote:
> >Can someone confirm or refute that the long double type
> >has 53 bits in its significand on i386?  Which header 
> >file in /usr/include provides this info?
> 
> A long double on an i386 is 64 bits by default.  The FP initialisation
> code in FreeBSD sets rounding precision to double so that only 53 bits
> are available.  You can override this in userland with fpsetprec() (but
> note this may adversely impact on the accuracy of some libm functions).

fpsetprec is deprecated.  In addition, one finds "... fpsetprec()
functions provide functionality unavailable on many platforms.  At
present, they are implemented only on the i386 and amd64 platforms".

> See the LDBL_* macros in <float.h> for native precision.

That's the problem.  The LDBL* macros misrepresent the
actual precision used.

-- 
Steve


More information about the freebsd-current mailing list