double confusion




I can't see the tree for the wood ...

my listing:

program bcont

double precision c
double precision a /2.0/
double precision b /2.0/

c=r(a,b)


write(*,*) 'result = ',c

stop
end


double precision function r(m,t)
double precision m
double precision t
r = m*t

c write(*,*) 'm = ',m,' t = ',t,' m*t= ',r

return
end


Within the function the print returns the correct result (2*2=4), but
in the main program the result seems to be 2.25000 ???

What the ? Sure, I've not written in fortran 77 (!) for a while, but I
feel myself like being a complete newbie.

Anybody a hint?

TIA

Julian

.



Relevant Pages

  • Re: double confusion
    ... double precision r ... my listing: ... double precision function r ...
    (comp.lang.fortran)
  • Re: function problem
    ... double precision t, s, kb, bt, kw, k1, k2 ... subroutine co2phta ... double precision co2, ph, ta, t, s ... double precision function kw_doe ...
    (comp.lang.fortran)
  • Re: Write statement does not print correct value?
    ... using a Fortran 77 compiler, the two write statements generate this ... DOUBLE PRECISION Value ... DOUBLE PRECISION FUNCTION Value ... "1p" modifiers make e formats nicer but have this!@#%! ...
    (comp.lang.fortran)
  • Write statement does not print correct value?
    ... When compiled and executed as shown on a SGI UNIX workstation ... using a Fortran 77 compiler, the two write statements generate this ... DOUBLE PRECISION Value ... DOUBLE PRECISION FUNCTION Value ...
    (comp.lang.fortran)
  • Salford Fortran - Double Precision product
    ... I solved all of them but the double precision product. ... double precision function norm ... computing the euclidean norm in these ways. ...
    (comp.lang.fortran)