Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Feb 2003 01:03:44 +0100
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        standards@freebsd.org
Subject:   Re: -fno-builtin world breaks in gperf
Message-ID:  <xzp8ywezc7z.fsf@flood.ping.uio.no>
In-Reply-To: <20030217213405.GB71679@rot13.obsecurity.org> (Kris Kennaway's message of "Mon, 17 Feb 2003 13:34:05 -0800")
References:  <xzp1y2755jc.fsf@flood.ping.uio.no> <20030217213405.GB71679@rot13.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Kris Kennaway <kris@obsecurity.org> writes:
> On Mon, Feb 17, 2003 at 03:46:15PM +0100, Dag-Erling Smorgrav wrote:
> > Our libm doesn't seem to support long double at all, yet our libstdc++
> > requires long double support.
> I pointed this out a while ago..looks like no-one did anything about
> it yet.

I've looked at it, and it looks Hard[tm].  The four architectures I
tested (alpha, ia32, ia64, sparc64) had four different representations
for long double:

alpha
 00 00 00 00 00 00 00 00
 3f f0 00 00 00 00 00 00
 40 09 21 fb 54 44 2e ea

ia32
 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 3f ff 80 00 00 00 00 00 00 00
 00 00 40 00 c9 0f da a2 21 77 50 00

ia64
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 3f ff 80 00 00 00 00 00 00 00
 00 00 00 00 00 00 40 00 c9 0f da a2 21 77 50 00

sparc64
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 3f ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 40 00 92 1f b5 44 42 ee a0 00 00 00 00 00 00 00

The numbers I tested were 0, 1, and as many digits of pi as I could
remember off-hand.  I've corrected for endianness so that the hex
digits are presented in big-endian order for all four architectures.

So far, I've concluded the following:

 - alpha doesn't have a separate long double type - it's just an alias
   for double which has an 11-bit exponent and a 52-bit mantissa.

 - ia32 and ia64 seem to have 80-bit long doubles which they store in
   96 and 128 bits, respectively.  They seem to use a 16-bit exponent
   and a 63-bit mantissa.

 - sparc64 seems to have 80-bit long doubles which it stores in 128
   bits (it's big-endian, so what looks like trailing padding is
   actually leading padding like on ia32 and sparc64).  It seems to
   use a 15-bit exponent and a 64-bit mantissa.

I haven't had a chance to look at powerpc yet.

An implementation of the ISO C long double math functions (all 92 of
them, not counting long double complex!) would have to handle all the
above cases, either in separate files or in #ifdef hell.  For alpha,
we could just define macros which cast the arguments to double, call
the appropriate double function and cast the result to long double,
but for the three other platforms (+ ppc?) we need actual code.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org

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




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