How Broken is Sun Fortran (Summary)

Keith Bierman fpgroup khb at chiba.Eng.Sun.COM
Fri Feb 8 15:20:31 AEST 1991


In article <1991Feb8.023527.20806 at fs7.ece.cmu.edu> winstead at faraday.ECE.CMU.EDU (Charles Holden Winstead) writes:

      1- Is Fortran on these Suns different than 'conventional' Fortran? i.e.
	 what do I have to look out for?

It is a "standard" Unix fortran by parentage, with several years of
extensions. Most inspired by user requests for "vax-like" features,
sometimes others (Cray style pointers). See the Fortran User's Guide,
and Reference manuals.

      2- Is there a debugger that works?  I've tried gdp and dbx and neither
	 can read the source code that fortran produces.  The same program
	 compile dwith the same flags can be read on a DEC machine, so I'm
	 figuring it's a problem in Sun Fortran.

Care to be more specific. dbx is far from perfect, but it can handle
many codes (the problem is that there are many that cause it grief ;<)

      3- Every now and then I get an error that says Warning: IEEE floating
	 Point Error. Inexact Underflow.  But it doesn't tell me where it
	 happened!  I guess an anwer to 2 would also answer this.

That isn't what it sez. Inexact and Underflow are not errors. I'd bet
a beer that the message is something like

	Warning: the following IEEE floating-point arithmetic
	         exceptions occurred in this program and were
		 never cleared:
			Inexact; Underflow

The easiest reference is the Numerical Computation Guide. Should have
been in the box with your other Fortran manuals (the entire set
includes the reference, the user guide, dbx, source browser and ncg).
There are also excellent papers by Kahan (From UCB, turning award
winner for floating point work).

Exceptions are NOT errors. These two are particularly common. If you
expected your computation to be exact (see the ieee 754 spec for the
definition) you would WANT to know if it wasn't (most of us use fp
specifically because we are interested in approximations, else we'd be
tempted to used fixed point arithmetic ;> or symbolic techniques ;>).
Underflow means that some computation was very close to zero. So
close, that _some_ accuracy was lost (unlike non-ieee machines, or
-fnonstandard mode where the result would have been flushed to zero,
entailing a larger and completely silent lossage).

If you wish to never see the message, irrespective of events (not
recommended!, what if there had been overflow? illegal operand?)  you
can do one of several things:

	1) add a call to ieee_flags (man ieee_flags shoudl work)
           clearing them all, or just the ones you don't care about.
	   Something like
		ieeer= ieee_flags("clear","exception","all",out)

	2) if you want to be truly evil, you could write your
	   own routine called ieee_retrospective, and link it in before
           libm.

There is also a sort of hitchhikers guide to this stuff in the Fortran
User's guide, Chapter 10.
--
----------------------------------------------------------------
Keith H. Bierman    kbierman at Eng.Sun.COM | khb at chiba.Eng.Sun.COM
SMI 2550 Garcia 12-33			 | (415 336 2648)   
    Mountain View, CA 94043



More information about the Alt.sys.sun mailing list