2.1 Numerical Robustness

next up previous
Next: 2.2 Data Parallelism Section Up: 2 Comparison of Fortran Previous: 2 Comparison of Fortran

2.1 Numerical Robustness


In section 3.3 below, Numeric Polymorphism, is an example of several versions of a picture-smoothing routine that are given one generic name. This generic capability is described there as one of the features that provide Fortran 90 with additional numeric robustness over Fortran 77 (and C). Fortran 77, Fortran 90, and C versions of subroutine SMOOTH are given here for comparison purposes. (Note that the Fortran 90 version makes use of the data parallelism described in section 4.)

Numeric polymorphism, plus real kind type parameterization, decimal precision selection, and numeric environmental inquiry, justify ranking Fortran 90 first among the four languages. The reason for ranking Fortran 77 second is its support for complex variables, important in many computational science applications. C++ nudges out C for third place due to its capabilities in the general area of polymorphism.

List of retrievable codes:

smooth77.f , and test_smooth77.f , Fortran 77 version of subroutine SMOOTH to compute a 3x3 average for each element of an input matrix, except for the edges of the matrix. (This is a simple version of a common technique for refining/enhancing a picture represented by a matrix.) And a Fortran 77 code to test smooth77.f.

smooth90.f, Fortran 90 version of subroutine SMOOTH.

test_smooth.c , C version of subroutine SMOOTH and test program. (C++ version would be similar, though classes would be used. if polymorphism were important as described in section 3.3).