Annotation of 43BSDTahoe/new/help/src/f77/to_double, revision 1.1

1.1     ! root        1: .TI F77/TO_DOUBLE "Sep. 4, 1985"
        !             2: Converting Programs to Double Precision
        !             3: 
        !             4: On VAXs, single precision provides about 6-7 digits of accuracy while
        !             5: double precision provides about 15-16 digits of accuracy.
        !             6: Many mathematical subroutine libraries assume
        !             7: double precision arguments.
        !             8: If you have a program written in single precision which needs to be
        !             9: run in double precision, you can either use f77's -r8 flag
        !            10: to compile it as if it were written in double precision,
        !            11: or follow the following steps to convert the source.
        !            12: If you use the -r8 flag, you still must check equivalences and
        !            13: common blocks as described in paragraph 9 below.
        !            14: 
        !            15: To convert a program from single to double precision:
        !            16: 
        !            17: .IP 1.
        !            18: Add 'implicit double precision (a-h,o-z)'
        !            19: as the first line of the main program (second line if you have
        !            20: a 'program' statement) and as the second line of all other 
        !            21: subprograms (subroutines, functions, and block data subprograms).
        !            22: 
        !            23: .IP 2.
        !            24: Change all 'real' or 'real*4' declarations to 'double precision'.
        !            25: 
        !            26: .IP 3.
        !            27: Change single precision floating point constants to double precision,
        !            28: either by adding 'd0' or changing an 'e' exponent term to 'd', e.g.:
        !            29: .nf
        !            30:                1.2    becomes 1.2d0
        !            31:                3.2e-5 becomes 3.2d-5
        !            32: .fi
        !            33: 
        !            34: .IP 4.
        !            35: Change 'complex' or 'complex*8' declarations to 'double complex'.
        !            36: 
        !            37: .IP 5.
        !            38: Formats do not need to be changed.
        !            39: 
        !            40: .IP 6.
        !            41: Change single precision intrinsic functions to double.  Because of the
        !            42: generic function names in f77, the only ones you need to actually change are:
        !            43: 
        !            44: .nf
        !            45:        single version:         double or generic version:
        !            46:           ifix()                       int()
        !            47:           sngl()                       dble()
        !            48:           real()                       dble()
        !            49:           float()                      dble()
        !            50:           amax1()                      max()
        !            51:           amin1()                      min()
        !            52:           amod()                       mod()
        !            53:           alog()                       log()
        !            54:           alog10()                     log10()
        !            55: .fi
        !            56: 
        !            57: .IP 7.
        !            58: Change complex intrinsic functions to double complex.
        !            59: 
        !            60: .nf
        !            61:        complex version:        double complex or generic version:
        !            62:           cmplx()                      dcmplx()
        !            63:           aimag()                      imag()
        !            64:           csqrt()                      sqrt()
        !            65:           cexp()                       exp()
        !            66:           clog()                       log()
        !            67:           ccos()                       cos()
        !            68:           csin()                       sin()
        !            69:           cabs()                       abs()
        !            70: .fi
        !            71: 
        !            72: .IP 8.
        !            73: If you are passing functions as arguments to other subroutines,
        !            74: you need to change all function names to specific functions.
        !            75: For example:
        !            76: 
        !            77: .nf
        !            78:                x1 = sqrt(x2)
        !            79:                c1 = abs(c2)
        !            80: .fi
        !            81: 
        !            82: works fine when x1 and x2 are double and c1 and c2 are double complex.
        !            83: However, if the computation is being done in a subroutine,
        !            84: 
        !            85: .nf
        !            86:                external sqrt, cabs
        !            87:                call subr( x1, x2, sqrt, c1, c2, cabs )
        !            88: .fi
        !            89: 
        !            90: it must be changed to:
        !            91: 
        !            92: .nf
        !            93:                external dsqrt, cdabs
        !            94:                call subr( x1, x2, dsqrt, c1, c2, cdabs )
        !            95: .fi
        !            96: 
        !            97: .IP 9.
        !            98: Check equivalences common blocks, and dynamic memory allocation.
        !            99: Often these implicitly assume that floating point and integer values
        !           100: use the same amount of storage.
        !           101: For example, if one subroutine declares:
        !           102: 
        !           103:                common /abc/ key1,vec(5),ival
        !           104: 
        !           105: and another declares:
        !           106: 
        !           107:                common /abc/ dummy(6), ival
        !           108: 
        !           109: then the two instances of 'ival' match.  If you change 'dummy'
        !           110: and 'vec' from single precision to double precision (either
        !           111: explicitly or via the -r8 flag), the two
        !           112: instances of 'ival' will no longer correspond.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.