From: Frank on
On Mon, 7 Dec 2009 23:06:48 +0000 (UTC), glen herrmannsfeldt wrote:

> Both do an interesting packing of the bits, such that some are
> used for both significand and exponent. Five bits 1.5 decimal digits,
> with one for the significand, and 0.5 (0, 1, or 2) as the leading
> exponent digit.

So, thinking of decimal digits as discrete is either quaint or just wrong?
I would have thought that 1.5 decimal digits were a typo, but then you talk
of another .5. I'd love to see an example.
--
frank
From: glen herrmannsfeldt on
Frank <frank(a)example.invalid> wrote:
> On Mon, 7 Dec 2009 23:06:48 +0000 (UTC), glen herrmannsfeldt wrote:

>> Both do an interesting packing of the bits, such that some are
>> used for both significand and exponent. Five bits 1.5 decimal digits,
>> with one for the significand, and 0.5 (0, 1, or 2) as the leading
>> exponent digit.

> So, thinking of decimal digits as discrete is either quaint or just wrong?
> I would have thought that 1.5 decimal digits were a typo, but then you talk
> of another .5. I'd love to see an example.

Digital voltmeters commonly come in 3.5 and 4.5 digits, displaying
up to 1.999 (actually a little less than 3.5).

With binary floating point, fractional decimal digits are somewhat
more obvious. 24 bits of significand corresponds to log10(2.**24),
or about 7.2 decimal digits.

In 32 bit IEEE decimal float, you get 7 decimal digits, and a
(base 10) exponent of between -95 and +96.

-- glen
From: Ken Fairfield on
On Dec 7, 2:07 pm, glen herrmannsfeldt <g...(a)ugcs.caltech.edu> wrote:
[...]
> Theoretically you should use TYPE(C_FLOAT) to get the appropriate
> type, but I would be pretty surprised to find that different from
> default REAL.  
>
> They might be different on hardware with more than one floating
> point type of the appropriate size.  VAX has two different 64 bit
> floating point formats.  With the addition of decimal float to
> the IEEE standard, it would be possible for a compiler to use that
> as its default floating point type.


VAX does not support any IEEE formats, although G_float is very
similar to IEEE double precision.

OTOH, Alphas have two different single precisions floating point
formats: F_float, the native VAX version, and S_float,
the IEEE version. For double precision (64-bit) there are
two VAX double precision formats, D_float and G_float, and
the IEEE version, T_float (three altogether). VAX also had
a 128-bit, extended precision float sort of optionally
available (I think it was a hardware add-in, but possibly
supported in software without the hardware) called H_float.
Seems that Alpha supports only the IEEE X_float for 128 bit
reals.

I haven't laid my hands on an IA-64 system running VMS to see
what it uses, but I believe it only supports the IEEE formats
noted above (with conversion to/from the VAX formats in I/O
if requested).

In any case, it's clear there are systems where one needs to
specify carefully the data types being used if one is worried
about bit representations and interoperability, etc.

-Ken
From: glen herrmannsfeldt on
Ken Fairfield <ken.fairfield(a)gmail.com> wrote:
(snip)

> VAX does not support any IEEE formats, although G_float is very
> similar to IEEE double precision.

> OTOH, Alphas have two different single precisions floating point
> formats: F_float, the native VAX version, and S_float,
> the IEEE version.

As I remember it, Alpha has load/store instructions that
support different formats, but there is only one format
for each width in the registers, which I believe is IEEE.
In some cases, a few low bits of the significand will be lost
on load or store. Also, overflow or underflow might occur.

> For double precision (64-bit) there are
> two VAX double precision formats, D_float and G_float, and
> the IEEE version, T_float (three altogether).

> VAX also had
> a 128-bit, extended precision float sort of optionally
> available (I think it was a hardware add-in, but possibly
> supported in software without the hardware) called H_float.
> Seems that Alpha supports only the IEEE X_float for 128 bit
> reals.

H float was standard on the 11/730, at least. For some of
the others it was optional (microcode), but supported by
software emulation if not hardware.

> I haven't laid my hands on an IA-64 system running VMS to see
> what it uses, but I believe it only supports the IEEE formats
> noted above (with conversion to/from the VAX formats in I/O
> if requested).

I have the Itanium Architecture books (three volume set), and
don't see anything related to VAX formats. Much of the floating
point description is for IA32-SSE. For the Itanium side, it
seems that the floating point registers are 82 bits wide,
and sometimes hold two 32 bit float values.

> In any case, it's clear there are systems where one needs to
> specify carefully the data types being used if one is worried
> about bit representations and interoperability, etc.

-- glen
From: Ken Fairfield on
On Dec 8, 1:28 pm, glen herrmannsfeldt <g...(a)ugcs.caltech.edu> wrote:
> Ken Fairfield <ken.fairfi...(a)gmail.com> wrote:
>
> (snip)
>
> > VAX does not support any IEEE formats, although G_float is very
> > similar to IEEE double precision.
> > OTOH, Alphas have two different single precisions floating point
> > formats: F_float, the native VAX version, and S_float,
> > the IEEE version.  
>
> As I remember it, Alpha has load/store instructions that
> support different formats, but there is only one format
> for each width in the registers, which I believe is IEEE.
> In some cases, a few low bits of the significand will be lost
> on load or store.  Also, overflow or underflow might occur.

Not true. Alpha has native F_float and G_float as well as
native IEEE S_float and T_float.

You may be thinking of D_float vs. G_float on Alpha where
D_float calculations are done using G_float instructions,
loads & stores and thus loses 3 bits of precision (the
D_float having a larger mantissa/smaller exponent range
than G_float). I don't recall at the moment whether the
D_floats are stored in memory in that format, or whether
the conversion is done during read/write. A little
googling would answer (but I don't particularly care to...).

[...]
> > I haven't laid my hands on an IA-64 system running VMS to see
> > what it uses, but I believe it only supports the IEEE formats
> > noted above (with conversion to/from the VAX formats in I/O
> > if requested).
>
> I have the Itanium Architecture books (three volume set), and
> don't see anything related to VAX formats.  Much of the floating
> point description is for IA32-SSE.  For the Itanium side, it
> seems that the floating point registers are 82 bits wide,
> and sometimes hold two 32 bit float values.

I don't think the Itanium architecture books are where you'd
find this information. It would be in OpenVMS documentation.
In particular, I was looking in the docs for the VMS Fortran
compiler (one of the few places that data type information
is clearly laid out in one place...likely thanks to Steve
Lionel and his mates :-). Fortunately or unfortunately,
there is only one Fortran User Manual on the web. That means
either the data types a common to Alpha and Itanium (with
Itanium likely doing conversion from F_float and G_float
to S_float and T_float), or they simply haven't posted the
Itanium version of that doc on the web. See:

http://h71000.www7.hp.com/doc/fortran.html

and in particular, the HP Fortran for OpenVMS User Manual:

http://h71000.www7.hp.com/doc/82final/6443/6443pro.html

and Chapter 8 of that manual:

http://h71000.www7.hp.com/doc/82final/6443/6443pro_026.html#ch_data

(And looking at the 2nd URL, it's clear the manual applies
to *both* Alpha and Itanium...)

-Ken