[comp.lang.fortran] f2c misbehaving?

ajayshah@alhena.usc.edu (Ajay Shah) (05/23/91)

This is the fortran program:

	double precision x
	integer i
	double precision anorm

	do i = -30, 20
		x = 1.0d0*i
		write(6, '(E30.22)') anorm(x)
	end do
	stop
	end

Here are the two outputs.  In this demo, nothing serious is
affected but it represents a difference between a fortran program
and a f2c translation.  This makes using f2c in more complex
situations difficult.

           from f2c                             from f77

   .4906713927148187177321-197	  0.4906713927148187177321-197
   .3289785266704380867514-184	  0.3289785266704380867514-184
   .8123869469659427264895-172	  0.8123869469659427264895-172
   .7389481006885018453671-160	  0.7389481006885018453671-160
   .2476063315503389241044-148	  0.2476063315503389241044-148
   .3056696706382561616593-137	  0.3056696706382561616593-137
   .1390392118549702977187-126	  0.1390392118549702977187-126
   .2330637006220649159568-116	  0.2330637006220649159568-116
   .1439892435145079305123-106	  0.1439892435145079305123-106
   .3279278018979036074213E-97	  0.3279278018979036074213E-97
   .2753624118606233737134E-88	  0.2753624118606233737134E-88
   .8527223952630977222754E-80	  0.8527223952630977222754E-80
   .9740948918937150769086E-72	  0.9740948918937150769086E-72
   .4105996202098906529308E-64	  0.4105996202098906529308E-64
   .6388754400538088218520E-57	  0.6388754400538088218520E-57
   .3670966199312751422570E-50	  0.3670966199312751422570E-50
   .7793536819192800037878E-44	  0.7793536819192800037878E-44
   .6117164399549880257194E-38	  0.6117164399549880257194E-38
   .1776482112077679037849E-32	  0.1776482112077679037849E-32
   .1910659574498675226475E-27	  0.1910659574498675226475E-27
   .7619853024160526919908E-23	  0.7619853024160526919908E-23
   .1128588405953840782741E-18	  0.1128588405953840782741E-18
   .6220960574271784860433E-15	  0.6220960574271784860433E-15
   .1279812543885835163949E-11	  0.1279812543885835163949E-11
   .9865876450376980905188E-09	  0.9865876450376980905188E-09
   .2866515718791939118538E-06	  0.2866515718791939118538E-06
   .3167124183311992432696E-04	  0.3167124183311992432696E-04
   .1349898031630094577191E-02	  0.1349898031630094577191E-02
   .2275013194817921205471E-01	  0.2275013194817921205471E-01
   .1586552539314570464679E+00	  0.1586552539314570464679E+00
   .5000000000000000000000E+00	  0.5000000000000000000000E+00
   .8413447460685429257765E+00	  0.8413447460685429257765E+00
   .9772498680518207914147E+00	  0.9772498680518207914147E+00
   .9986501019683698965324E+00	  0.9986501019683698965324E+00
   .9999683287581668800215E+00	  0.9999683287581668800215E+00
   .9999997133484280764648E+00	  0.9999997133484280764648E+00
   .9999999990134122995755E+00	  0.9999999990134122995755E+00
   .9999999999987201348972E+00	  0.9999999999987201348972E+00
   .9999999999999993338662E+00	  0.9999999999999993338662E+00
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
   .1000000000000000000000E+01	  0.1000000000000000000000E+01
-- 
_______________________________________________________________________________
Ajay Shah, (213)734-3930, ajayshah@usc.edu
                             The more things change, the more they stay insane.
_______________________________________________________________________________

ags@seaman.cc.purdue.edu (Dave Seaman) (05/23/91)

In article <33089@usc> ajayshah@alhena.usc.edu (Ajay Shah) writes:
>Here are the two outputs.  In this demo, nothing serious is
>affected but it represents a difference between a fortran program
>and a f2c translation.  This makes using f2c in more complex
>situations difficult.
>
>           from f2c                             from f77
>
>   .4906713927148187177321-197	  0.4906713927148187177321-197
	[ many lines deleted ... ]

Since you didn't say what difference you thought you saw, it is a little
difficult to answer the question.  The only obvious difference is that f77
provides the optional zero before the decimal point, and f2c omits it.  Both
are standard-conforming.

--
Dave Seaman
ags@seaman.cc.purdue.edu