Quad Precision Floating Point Test
Accuracy is important for many applications, and faster machines
mean that more operations may be used to compute a single number.
Thus standard 64 bit double precision floating point numbers
may not be accurate enough when millions of operations are performed with
the millions of round off errors accumulated in the final answer.
Here we present a simple program (Fortran 77) written to test
the accurarcy of for Unix scientific computing machines installed
centrally here and the University of Delaware.
The Program
The order of operations and the form of the expression in any
program using floating point numbers will affect the answer.
Here we have a Fortran program which evaluates
16 expressions. These are grouped in to 4 groups of 4 expressions.
In each group the value of the expressions should be mathematically
the same. We also have used Mathematica as a outside source to
calculate all these expressions to 50 digits, which is more than
a quad precision floating point number can store. These numbers
computed by Mathematica are printed as literals in the program.
To see the program - ftest.f.
The machines
- strauss -
Sun Ultra Enterprise 4000 (250 MHz UltraSPARC CPUs each with 4MB of Cache)
- This machine has 128 bit IEEE compliant floating point numbers. This
breaks down to - 1 sign bit - 15 exponent bits - 111 fraction bits. As
in all IEEE floating point numbers, a normalized number does not store
the leading bit, since it is always one, thus effectively the fraction
is 112 bits. The IEEE standards also specify the way these numbers should
be operated on with underflow and rounding rules. The intent is
to make the results from floating points calculations easy to
analyze and identical accross machines.
- joplin -
Cray Research J916/8-102 (200 MHz Cray-compatible CPU)
- The Cray does not have standard floating point hardware. It
has 60 bit and 120 bit numbers. When a Fortran program asks for
REAL*16 it gets the 120 bit numbers. The compiler does not
recognize the q notation to indicate a quad precision literal.
- mozart -
IBM RS/6000, model 990 (64KB data cache)
- The rs/6000 series does have IEEE compliant 64 bit floating point
numbers, but it handles quat precision by treating a REAL*16
number as two independtly normalized 64 bit numbers. In some cases
this trick can delay the need to normalize the number and squeeze
more bits out of the calculations, but this usually does not
make up for the fact it does not use as many bits for the fraction.
(This also means the range of the numbers the same for double and
quad precision on mozart)
- gershwin -
SGI Power Challenge XL system (R10000 CPU with 2MB cache)
- The Power Challenge has quad precision in what is called
"64 bit mode", which is attaineb by using the
the "-64" option on the f77 compiler.
If you try to compile a program in 32 bit mode which has REAL*16
or quad literals it warns you that it is not really doing what
you asked for. Gershwin fails this test in 32 bit mode since it really
needs more the 64 bits. The quad precision format is the same
mozart and not IEEE compliant.
The Results
This same program was run on all four machines using the default Fortran
options from the make command. (Except gershwin where the default -32 did
not work on this test. We used setenv FFLAGS -64 -O to set the
Fortran flags to include 64 bit optimized code.) The results are
presented comparing strauss to each of the other three machines. In
the charts the red digits are incorrect when compared with the more
accurate Mathematica caculations.
Comparision charts:
Conclusions
- strauss gives the most consistently accurate results.
- mozart is comparable to strauss, but is not as consistent. The
first test shows this since the third expression has 1 decimal
digit more and the last expression has 2 fewer digits than strauss.
Mozart is more dependent on the expressions than strauss.
- gershwin is the next most accurate. The fact that gershwin is
less accurate than mozart is surprising since the
both user the same storage method. Gershwin seems to not do as
well as mozart in the last few bits of every calculation.
- joplin is least accurate because it only has 120 bit hardware.
- None of the machines do very well in the log caculation, but
strauss was the most consistent giving the same accuracy for all four
forms of the expression. Changing the
generic function name from 'log' to 'qlog' does not help in any
of the cases.