Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Oct 2002 22:51:58 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        rittle@labs.mot.com, <rittle@latour.rsch.comm.mot.com>, <current@freebsd.org>, <dschultz@uclink.Berkeley.EDU>
Subject:   Re: Lack of real long double support
Message-ID:  <20021029222447.L1273-100000@gamplex.bde.org>
In-Reply-To: <20021028.214057.108404482.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 28 Oct 2002, M. Warner Losh wrote:

> In message: <200210290211.g9T2BBcP010112@latour.rsch.comm.mot.com>
>             Loren James Rittle <rittle@latour.rsch.comm.mot.com> 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....

Better change FreeBSD to match the unhacked version :-).

> : gcc 3.3 will support a framework in which such changes would be easy
> : to convey at compile-time but, to my knowledge, there is no support
> : yet to obtain e.g. the precision setting at run-time.  I.e. <float.h>

FreeBSD (on i386's) has fpgetprec() to get it and fpsetprec() to set it,
but these are nonstandard and won't become standard.  They don't exist
on most or all non-i386's now, unlike fpget/setround() which will become
the standard feget/setround().

> : is now completely dynamically created at compile-time based on the
> : exact knowledge within gcc of the FP hardware; but it is static
> : w.r.t. eventual run-time.  It does not know how to effectively export
> : a function ala FreeBSD/alpha's <float.h>:
> :
> : #define FLT_ROUNDS      __flt_rounds()

I hope an alpha person will explain the details of this.  Where is the
default configured?

> : One issue, the standard says that various macros related to float
> : limits are constant expressions (as may be used to influence the
> : preprocessor?).  The above construct doesn't conform but I understand
> : the intent.

The standard has a special exception for FLT_ROUNDS.

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

Actually, it didn't support the hardware.  The hardware was implemented
long before the (C) standard.

> 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

The standard doesn't have a special exception for anything in float.h
except FLT_ROUNDS :-.

> that it would matter in any real context.  I don't think that you can
> do floating point in the preprocessor...

Not in non-broken preprocessors.

Bruce


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?20021029222447.L1273-100000>