Double Precision

Statement Purpose

This is a variable type declaration statement that extends the range of floating point numbers in a program. It was introduced in early FORTRAN to provide a way for programmers to get more decimal digits of precision. The increased precision could then be used to get more accurate answers to scientific and engineering computations since it extended the number of computations that could be done until round off error became a serious problem.

Examples and rules

Declaring variables with this type declaration statement is similar to declaring variables with any other type statement. Just type the statement DOUBLE PRECISION followed by an attribute list and then the names of any variables that you want to be of this type. Also, it is worth mentioning that DOUBLE PRECISION will support all of the attributes, like dimension, allocatable, target, and pointer, that the INTEGER and REAL declarations will support. Therefore, this statement's general appearance will be similar to the following examples.
		double precision drag,q,Re,rough
		double precision, allocatable :: loc(:,:),fdata(:)
Even though this declaration will give you greater accuracy, it's capabilities have been surpassed by the FORTRAN 90 intrinsic functions selected_int_kind and selected_real_kind. The use of these functions gives a programmer better control over the number of decimal digits of precision and exponent range with variables. Because of this many programmers now favor the use of these functions in combination with the REAL type statement, over the use of DOUBLE PRECISION statement.

For Additional Examples and Information See

lecture twenty one

examples: format.f and quad.f

Up one level / Home


Written by Jason Wehr : jcw142@psu.edu and Maintained by John Mahaffy : jhm@cac.psu.edu