Article View: comp.sys.atari.st
Article #23984Re: floating point info wanted
From: braner
Date: Thu, 11 Dec 1986 06:24
Date: Thu, 11 Dec 1986 06:24
42 lines
2246 bytes
2246 bytes
[]
The double-precision IEEE format, used for example by the Megamax C
FP library, is as follows: (msb to lsb) (64 bits total)
sign bit
11-bit exponent (powers of 2)
52-bit mantissa (binary)
The sign bit is 1 for negative. (0.0 is all-bits-0.)
The exponent has $3FF added to it, so it's always positive.
The mantissa assumes an extra, "hidden" bit on the left, which is always '1'.
The mantissa is always positive: no twos-complements are used here!
Examples: the value 1.5 is: $3FF8,0000,0000,0000
the value -5 is: $C014,0000,0000,0000
Note that the msb is LOWEST in terms of 68000 RAM addresses. For example,
if the value -5 is pointed to by a pointer with the value 10000, then
the addresses 10000, 10001, etc hold the byte values $C0, $14, etc.
The single-precision format is similar in spirit, but is 32 bits long,
and the exponent is 8 bits long. Note that since the exponents are of
different lengths, the most significant 32 bits of a double are _NOT_
a usable float!!!
Note also that the IEEE conventions are rather ill-suited for efficient
calculations on the 68000 architecture, although they work quite well on
dedicated hardware such as the 8087 or the 32081. For comparision, DBASIC
(as far as I know) uses the format: (64 bits total)
sign bit
two "don't care" bits
13 bits exponent, with $1000 added
48 bits mantissa, with NO "hidden" bit
For example, -5 is: $9003,A000,0000,0000
- Moshe Braner
PS: When will C compilers come with high quality FP packages, like the
(reportedly good) one supplied with AbSoft FORTRAN?????
Technical Details
Message-ID:
<1786@batcomputer.tn.cornell.edu>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!brl-adm!seismo!rochester!cornell!batcomputer!branerReferences:
<4086@utah-cs.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!brl-adm!seismo!rochester!cornell!batcomputer!braner From: braner@batcomputer.UUCP Newsgroups: comp.sys.atari.st Subject: Re: floating point info wanted Message-ID: <1786@batcomputer.tn.cornell.edu> Date: Thu, 11-Dec-86 01:24:55 EST Article-I.D.: batcompu.1786 Posted: Thu Dec 11 01:24:55 1986 Date-Received: Sun, 14-Dec-86 11:30:09 EST References: <4086@utah-cs.UUCP> Reply-To: braner@batcomputer.UUCP (braner) Organization: Theory Center, Cornell University, Ithaca NY Lines: 42 Summary: IEEE and DBASIC formats explained