[comp.sys.sun] f77 and floating point?

droms%hydra.bucknell.edu@cunyvm.cuny.edu (Ralph E. Droms) (01/24/89)

I just completed an experiment in which I ported a 2000 line VMS FORTRAN
program to f77 on a variety of Suns.  The experiment raised a few
questions and prompted a few observations.

1) Am I correct in observing that the -switch option chooses only between
software FP and the FPA.  I found that, to take advantage of the 68881
chip, I needed to specifically use -f68881.

2) I observed differences in the output between software FP and the 68881
(more about this later).  Is this expected?

3) In trying to locate the reasons for 2), I tried to use the FORTRAN
version of the "paranoia" FP analysis program.  f77/SunOS 4.0 wouldn't
link the program due to a missing DLOG library routine.  The following
program also fails:

      double precision x, y
      do 10 i = 1,10
      x = i
      y = dlog(x)
      write(6,100)i, x, y
 100  format(i4, f10.6, f10.6)
 10   continue
      stop
      end

Is this a known problem or are we doing something wrong?

4) I did manage to run the C version of paranoia.  It reports the
following results with the 68881:

Some subexpressions appear to be calculated extra precisely with about 11
extra B-digits, i.e.  roughly 3.31133 extra significant decimals.  That
feature is not tested further by this program.

Checking rounding on multiply, divide and add/subtract.
* is neither chopped nor correctly rounded.
/ is neither chopped nor correctly rounded.
Addition/Subtraction neither rounds nor chops.
Sticky bit used incorrectly or not at all.
FLAW:  lack(s) of guard digits or failure(s) to correctly round or chop
(noted above) count as one flaw in the final tally below.

(The software floating point emulation completes with no reported flaws.)

5) Finally, I found the the original program runs roughly as fast on a
3/60+68881 as on an 11/780+FPA.  Has anyone else gathered corroborating
data?

- Ralph Droms
  Bucknell University
  Lewisburg, PA 17837

  droms@sol.bucknell.edu
  droms@bknlvms.bitnet
  (717) 524-1145