Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Oct 2002 05:37:57 -0600 (CST)
From:      Loren James Rittle <rittle@latour.rsch.comm.mot.com>
To:        current@freebsd.org
Cc:        imp@bsdimp.com
Subject:   Re: Lack of real long double support
Message-ID:  <200210291137.g9TBbvl0074453@latour.rsch.comm.mot.com>
In-Reply-To: <20021028.214057.108404482.imp@bsdimp.com>
References:  <200210290211.g9T2BBcP010112@latour.rsch.comm.mot.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <20021028.214057.108404482.imp@bsdimp.com> imp writes:

> This works.  I'm not sure why this isn't the default.  It looks like
> we have hacks in the local tree to do this, which is why I thought
> that it worked great by default....

> This is true too.  See the fpsetprec() call that I had to add to make
> things work above.

Yes, I know about that call.  I conditionally added it to at least one
gcc i386 FP test case that assumed 64-bit precision.  However, the
system header <float.h> is suppose to reveal the FP hardware as it is
configured not as some user could litter their code to make it so, no?

> Yes.  The standard didn't anticipate the fp hardware that intel made.

C89, perhaps (although given the timing, I'm skeptical).  C99, no way.

> One could do something like:
>
> #define LDBL_EPSILON (fpgetprec() == FP_PE ? _LDBL_EPSILON :  DBL_EPSILON)
>
> But as you said, this isn't a compile time constant.  I'm not sure
> that it would matter in any real context.  I don't think that you can
> do floating point in the preprocessor...

This proposal isn't bad IMHO.  It would clearly explain to the gcc
team what type of FP support we'd want even if not in full compliance
with the standard text.  And, to avoid all compliance problems, perhaps:

#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) && !defined(__STRICT_ANSI__)
// for i386, match default as expressed in __INITIAL_NPXCW__
#define LDBL_MANT_DIG 53
#define LDBL_EPSILON 2.2204460492503131E-16
[...]
// changing LDBL_MANT_DIG subtly changes every value not just LDBL_EPSILON)
#else
// Assume something would have to be done to avoid including <ieeefp.h>
#define LDBL_MANT_DIG (fpgetprec() == FP_PE ? _LDBL_MANT_DIG :  DBL_MANT_DIG)
#define LDBL_EPSILON (fpgetprec() == FP_PE ? _LDBL_EPSILON :  DBL_EPSILON)
[...]
#endif

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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