views:

316

answers:

1

Does anyone knwow what the postfix "d+0" means in the assignments to M1, M2 and M4 below or is there any resource on the web or a book where one is very likely to find this information?


      subroutine plot( t, x, p, q, nga, nt, wron, 
     &                 ngq, gq, ngaq1, ngaq2, gaq, rwh, iwh )
        implicit none

        integer*4 nga, nt, ngq, ngaq1, ngaq2, iwh(*)

        real*8 t, x(*), p(*), q(*), wron(nga,*),
     &         gq(ngq,*), gaq(ngaq1,ngaq2,*), rwh(*)

        real*8 M1, M2, M3, M4, mr, mst, h3, Tc
        integer*8 iflag

c       DISCRETIZE1( Tc, rwh, iwh )

        M1 = 0.1362d+0
        M2 = 0.09806d+0
        M3 = M1 + M2
        M4 = 0.236d+0

        mr = M1*x(1) + M2*x(2) + M3*x(3) + M4*x(4)
        mst =  M1*q(1) + M2*q(2) + M4*q(3)

        call mess3( t, x, h3, p, q, rwh, iwh, iflag )

        write (10,100) t, x(1), x(2), x(3), x(4), Tc, h3, mr-mst
100     format( e20.10, 7(1x,e20.10) ) 

  end
+5  A: 

It means "double precision" and the +0 means 10 to the zeroth power (zero is the exponent).

Here's a quote from first reference I could find:

A number stored in a computer is limited in magnitude and precision. The limits depend on the particular computer. Thus, a REAL number has only a certain number of significant digits. If more significant digits are required for a calculation, then DOUBLE PRECISION numbers must be used. A DOUBLE PRECISION constant is written in the same exponential form as a single precision REAL constant except with a D instead of an E separating the mantissa from the exponent.

And here is a quote from a better reference, www.fortran.com, specifically the F77 standard.

4.5.2 Double Precision Constant.

The forms of a double precision constant are:

  1. Basic real constant followed by a double precision exponent
  2. Integer constant followed by a double precision exponent

The value of a double precision constant is the product of the constant that precedes the D and the power of ten indicated by the integer following the D. The integer constant part of form (2) may be written with more digits than a processor will use to approximate the value of the constant.

tvanfosson
o__O wow thanks for the immediate reply, I was looking for chat rooms/channels for Fortran newbies but you answered my question even before I had time to decide which IRC client to use!!
Cetin Sert