**Subject:** Re: NetBSD/vax 1.6 pkgsrc perl build?

**To:** None *<port-vax@netbsd.org>*

**From:** der Mouse *<mouse@Rodents.Montreal.QC.CA>*

**List:** port-vax

**Date:** 11/03/2002 04:00:31
> Just for curiosity, I'd love to know more about VAX floating point...
> is it more accurate / less accurate?
Yes. :-)
> What does a fp register look like?
There are no fp registers per se; fp numbers are kept in the same
registers all other data types are. (Like quadword and octaword, 64-
and 128-bit floating point values occupy multiple registers.)
fp numbers are stored sign-magnitude, exponent and mantissa, with a
hidden bit, very much like IEEE floats in this broad sense. However,
there are no denormalized numbers (numbers too small to represent
without denormalizing underflow to zero), no infinities, and no NaNs in
the IEEE sense. (There *are* reserved operands, which can serve some,
but not all, of the same purposes; they're somewhat like IEEE signaling
NaNs. Quiet NaNs have no analog. Any bit pattern with sign bit 1 and
all exponent bits zero is a reserved operand. Sign and exponent bits
all zero is 0.0, regardless of the mantissa bits.)
I don't find any definitive reference handy saying how many bits are in
the exponent and mantissa portions (my VARM is on another continent
from me at the moment). I find a non-definitive source that implies
there are 8 exponent bits in D-float. I do think that D-floats (64
bits) and F-floats (32 bits) have the same number of exponent bits,
unlike IEEE single and double floats. (There are also G-floats and
H-floats; I *think* G-float is a 64-bit format with more exponent bits
at the price of the corresponding number of mantissa bits and H-float
is a 128-bit format, but I'm not sure of even that much, never mind
details.)
I also think VAX fp is "weird-endian", showing traces of its PDP-11
heritage. If you have an F-float that conceptually looks like
s[eeeeee][--m1-][--m2--][--m3--] in a register and you inspect it as an
integer, the bits you will see are [--m2--][--m3--]s[eeeeee][--m1-].
Fortunately, you rarely care about this. (lib/libm/arch/vax/n_sqrt.S
is an example of code that does.)
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B