sandra@utah-cs.UUCP (Sandra J Loosemore) (12/10/86)
Can anyone provide details on the internal representation of floating point numbers used by the various C compilers for the ST? Thanks, -Sandra Loosemore (sandra@utah-cs.arpa)
braner@batcomputer.UUCP (12/11/86)
[] 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?????