From: Peter Sanger <peter.sanger@mailbox.swipnet.se>
Subject: Re: Precision on an Alpha
Date: 1997/04/26 [thread overview]
Message-ID: <33624533.30358528@mailbox.swipnet.se> (raw)
In-Reply-To: 335FE9E7.41C6@latoso.cheme.cornell.edu
Jeffrey Potoff wrote:
>
> Marcus A. Cuda wrote:
> >
> > Hi,
> > We are running into a problem on a DEC AlphaStation 4/233.
> > When running a routine in an econometrics package, we get the following
> > error:
> >
> > > forrtl: error (65): floating invalid
> > > IOT trap (core dumped)
> >
> > The person who wrote the package blames the Alpha chip for this problem:
>
> That would be incorrect. There is a bug in the code.
>
> > >I would guess that the Alpha machine is using the same technology DEC
> > >used with the VAX.
>
> That would also be incorrect.
>
> > The VAX machine always had a problem in that the
> > >range of values that it could represent in double precision was only
> > >10**(-38) to 10**(+38). Other current machines, including PCs have a
> > >range of exponents in excess of 300.
>
> Our Alpha can go up from 10**(-300+) to 10**(+300+)
>
> >
> > The package is distributed as FORTRAN source code. When compiled on a
> > SUN/UNIX or INTEL/WINDOWS machines the problem does not occur.
> >
The "floating invalid" error means that the memory location that a float
or double variable references contains a "value" (bit pattern) that is
not a valid representation of a floating point number.
Floating point numbers consist of two parts: the exponent and the
mantisse.
For a double presission variable, the exponent allows for ranges between
10**-308 and 10**+308, and the mantisse has a precission of about 15
decimals. The mantisse is normalized, so that the first bit of the
mantisse
is always '1' and therefore needs not be stored. (Think of this as
representing decimal numbers as 1.23E+45: the exponent is chosen such
that the number before the decimal point is always between 1 and 9).
The range of floating point numbers can be extended a little towards
smaller
numbers by allowing subnormalization. (Think of it as using 0.01E-45).
The
price payed is that you no longer have a precission of 15 decimals.
In Digital Unix subnormalized floating point numbers are trapped by the
operating system as a "floating invalid" operation.
Many platforms (used to) allow the use of these subnormalized floating
point values. This may explain why the program can be run on other
platforms without problems.
Now the question is: why do I get a subnormalized floating point value,
if they are trapped by the OS?
On a platform that does not allow subnormalized floating point values,
floating point calculations will not result in a subnormalized number,
but cause a floating point underflow error or simply result in 0.0 .
The most likely explanation is that the program is buggy. Small positive
integer values happen to have exactly the same bit represenation as
subnormalized floating point values. The program may have stored an
integer
value at the memory location and is now trying to read from the same
location as if it was a floating point number. (Passing an integer
argument to a subroutine/function call that expects a float?
Inconsistant definitions of
common blocks? Inconsistant use of EQUIVALENCE? Uninitialized variable?)
These bugs are never trapped on a platform that allows subnormalized
floats,
and may live in a program for a long long time before being discovered.
Peter
--
Peter Sanger E-mail: peter.sanger@mailbox.swipnet.se
Karlhovsvagen 17 Phone: +46 8 55069514
15137 Sodertalje, Sverige Fax: +46 8 55069514
next prev parent reply other threads:[~1997-04-26 4:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-04-24 4:00 Precision on an Alpha Marcus A. Cuda
1997-04-24 4:00 ` Jeffrey Potoff
1997-04-26 4:00 ` Peter Sanger [this message]
1997-05-01 4:00 ` Keith Bierman QED
1997-04-24 4:00 ` Ron Natalie
1997-04-25 4:00 ` Phillip Helbig
1997-04-25 4:00 ` Don Dossa
1997-04-25 4:00 ` Carl Perkins
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox