Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: infinity and beyond



> With respect to the binary representation of infinity on the vax:
> [...]

VAX floating-point does not have infinities.  Depending on the purpose,
the most positive/negative representable numbers may be suitable
substitutes, or perhaps reserved operands.

> const union __double_u __infinity =
>         { { 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };

This is the largest representable double.  Certainly a defensible
option.

> I found:
> http://h71000.www7.hp.com/doc/82final/6443/6443pro_027.html

> which describes that DEC^WCompaq^WHP fortran uses 0 mantissa all 1's
> exponent to represent infinity.

That page is a bit broken - I have to turn on historical-compatability
comment parsing to get any content - but I think I found what you're
talking about, and I think it's misled you.

Here's the text I'm talking about:

     * Infinity---An IEEE floating-point bit pattern that represents plus
       or minus infinity. HP Fortran identifies infinity values with the
       letters "Infinity" or asterisks (******) in output statements
       (depends on field width) or certain hexadecimal values (fraction
       of 0 and exponent of all 1 values).

Note this is an _IEEE_ float.  A couple of paragraphs earlier:

   Exceptional values usually result from a computation and include plus
   infinity, minus infinity, NaN, and denormalized numbers. Exceptional
   values and the representation of zero are associated only with IEEE
   S_float, T_float, and X_float formats (/FLOAT=IEEE_FLOAT qualifier),
   not with VAX floating-point formats.

Note "only with IEEE...not with VAX".

> Should we switch to that?

Not on the VAX, I would argue.  It isn't infinity in any useful sense.

> Either way, I think that programs expect to be able to do:

>       double x = INFINITY;

> and that is currently broken on the vax.

I think it's a defensible proposition that it _should_ break on the
VAX, because VAX floating point does not have anything that acts the
way generally expected by programs that try to manipulate infinities.

The only useful things I can see that that could turn into on the VAX
are (1) a reserved operand, (2) the largest representable positive
value, and (3) a compile-time error.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index