...Tutorial
This work partially supported by the Numerical Algorithms Group Ltd. and the National Science Foundation (CDA-9017953).
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...Dodson
dzdod@cs.unm.edu
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...is
Information on the integer and floating-point models, as well as the following tables is taken from chapter 13 of [1].
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...declaration.
The double colon, ` ::', is necessary when more than one attribute is given for a variable, or the variable is to be initialized.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...computers.
Another important feature of array-valued expressions is that there is no defined order in which the operations must be done. The operations may be performed in any order or simultaneously.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...above.
Most binary operations operate elementally on array operands, requiring that the two array operands be conformable, that is, the same size and shape. For example, the binary operator `*' forms an element-by-element product of two matrices. Scalars may also be used in such operations, as they are first broadcast to a conformable array before the elemental operation is performed.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...size.
The rank of an array is fixed at compile-time and may not be assumed by a subprogram.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...statement.
The recursive keyword is required for the benefit of the compiler and may help with the optimization of procedure calls.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...pointer.
This restriction can aid the compiler in optimizing the code. The target attribute informs the compiler of all variables that can serve as pointer targets. All other variables cannot be referenced via a pointer and do not suffer from the side effects of pointer references.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...attribute.
The other integer variable m declared in the program does not have the target attribute. Consequently, it may not be associated with a pointer.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...n).
A Fortran 90 pointer has three possible states: associated, disassociated, and undefined. Initially, a pointer's association status is undefined. It may be associated using pointer assignment or the allocate statement. It may be disassociated using the nullify statement or by assigning it a disassociated pointer through pointer assignment.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...itself.
This immediately implies that pointers cannot point to other pointers.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...precision.
Similar definitions of other arithmetic operations on intervals can be stated.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...magnitude.
In the previous exercise, this occurs in calculating the smaller root.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...47#47.
As will be shown shortly, can be another source of cancellation. This is a potentially serious problem because the application of the square root function could bring the inaccurate low order digits to significance.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

...only.
A Fortran 90 double precision number is required to contain at least twice as many digits in the mantissa as a single precision number. This guarantees that b2 is representable in double precision. The product 4ac is also immune to roundoff error on a machine with a binary base. Thus, the two values b2 and 4ac may be computed exactly in double precision.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...Three-digit.
Three-digit decimal arithmetic using unbiased rounding truncates after the third digit if the fourth digit is 4 or less, rounds the third digit up if the last digit is 6 or more, and rounds the third digit to an even digit if the fourth digit is exactly 5.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Using three-digit....
Using three-digit arithmetic and unbiased rounding, you should obtain roots 0.05 and 12.4. Note that the larger calculated root is correctly rounded while the smaller calculated root has no correct figures.