Problems with DEC Fortran exp() library routine (UNDERFLOW/OVERFLOW)

Matthew Trunnell matter at milton.u.washington.edu
Wed May 15 01:41:42 AEST 1991


We have been noticing some very buggy behavior with the exp() library routine
in DEC Fortran.  The problem is that, when passed a large negative exponent,
the routine generates either an OVERFLOW or an arbitrary number depending
on the -fpe option used.  Here is some sample output:


Script started on Mon May 13 15:36:11 1991
(killer)1> cat t.f
	program t

	do 100 i=80, 100
		fi = float(i)
		a  = exp(-fi)
		print *, i, a
100	continue

	end
(killer)2> f77 -fpe0 t.f
(killer)3> a.out
          80  1.8048513E-35
          81  6.6396770E-36
          82  2.4426007E-36
          83  8.9858262E-37
          84  3.3057005E-37
          85  1.2160993E-37
          86  4.4737793E-38
          87  1.6458115E-38
forrtl: error: floating overflow		<- OVERFLOW, not UNDERFLOW,
Illegal instruction (core dumped)		   as it should be
(killer)4> f77 -fpe1 t.f
(killer)5> a.out
          80  1.8048513E-35
          81  6.6396770E-36
          82  2.4426007E-36
          83  8.9858262E-37
          84  3.3057005E-37
          85  1.2160993E-37
          86  4.4737793E-38
          87  1.6458115E-38
          88Infinity       			<- The number was too SMALL
          89Infinity       			   to handle--so it was set
          90Infinity       			   to INFINITY!
          91Infinity       
          92Infinity       
          93Infinity       
          94Infinity       
          95Infinity       
          96Infinity       
          97Infinity       
          98Infinity       
          99Infinity       
         100Infinity       
(killer)6> f77 -fpe2 t.f
(killer)7> a.out
          80  1.8048513E-35
          81  6.6396770E-36
          82  2.4426007E-36
          83  8.9858262E-37
          84  3.3057005E-37
          85  1.2160993E-37
          86  4.4737793E-38
          87  1.6458115E-38
forrtl: error: floating underflow
forrtl: error: floating underflow
forrtl: error: floating overflow
          88  -862.7500    			<- ??? 
forrtl: error: floating overflow
          89  1.8626075E-35			<- ???
          90 -1.2258180E+15			<- ???
          91  1.3533067E-24			<- Where the heck are these
          92 -3.7006078E+19			   numbers coming from??
          93   177568.0    			<-
          94 -3.3480398E+25			<-
          95  -14.99609    			<-
          96  3.8368579E-23			<-
          97  7.7316458E-31			<-
          98  1.8650276E-19			<-
          99  1.3840992E+28			<-
         100  1.3298483E+08			<-
forrtl: info: 26 floating underflow traps
forrtl: info: 13 floating overflow traps
(killer)10> ^D
script done on Mon May 13 15:39:23 1991


This is DEC Fortran for ULTRIX v3.0 External Field Test 5, running on a
DECstation 5000 under ULTRIX v4.0
_____________________________________________________________________________
Matthew Trunnell Ec-2				matter at ocean.washington.edu
School of Oceanography, WB-10
University of Washington
Seattle, Washington 98195			206-543-0686
_____________________________________________________________________________



More information about the Comp.unix.ultrix mailing list