VAX float vs. double

der Mouse mouse at mcgill-vision.UUCP
Sat Aug 20 15:18:49 AEST 1988


In article <8808092015.AA26033 at pepperell.lti.com>, reg at lti.UUCP (Rick Genter x18) writes:
> I can envision a situation where sizeof (float) == sizeof (double),
> the difference being that floats trade off mantissa bits for exponent
> bits.  I believe the VAX architecture provides this.

Only if you stretch a point.  The "plain vanilla" float on a VAX is 32
bits split up as follows:

1	sign
8	exponent
23	mantissa

(there's also the hidden bit in the mantissa, but it's not stored so
I'll ignore it.)

The "plain vanilla" double is identical except that it has 32 more bits
of mantissa (64 bits in all, of which 55 are mantissa).

There are two more formats, but they aren't used much because hardware
support for them is not universal among VAXen, as it is (I think) for
F-float and D-float (as the above "float" and "double" are called).

They are G-float, which is 64 bits split up into 1 sign, 11 exponent,
and 52 mantissa; and H-float, which is 128 bits split up into 1 sign,
15 exponent, and 112 mantissa.

So the only way to get the situation you describe is to consider
D-float and G-float as "float" and "double".  (It's not clear to me
which would be which: whether double should have greater range or
better precision.)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list