Converting Fortran Programs to Multiple Precision

Dr. David M. Smith
Professor of Mathematics (Emeritus)
Loyola Marymount University
Los Angeles, CA

Automatic conversion of Fortran programs to use FM

Convert2FM.f95 is a Fortran program that tries to automate most of the changes needed to convert
a normal Fortran program to a multiple-precision version using FM.

The philosophy behind this program is not to try for perfect complete conversions, but to
make most of the routine changes needed to get an FM version of an existing program.

It is a "quick-and-dirty" program that I wrote to automatically convert constants to FM
form, change declarations, and insert the USE FMZM, CALL FM_ENTER_USER_ROUTINE, ...
statements into each routine.

Please do not write to tell me Convert2FM is ugly, not well-designed, inelegant, etc.
I already know that. If you write your own beautiful, well-designed, elegant version
of Convert2FM, please send me a copy. If I like it, I will post it here and give you
full credit.

The actual files shown on this page are in this archive that contains all the FM files from this

The individual file pointers here display as pdf files for browsing. The longer files are cut
off after 20 pages.

How to convert to FM

This file, taken from the user's manual, discusses the steps needed to convert
a standard program to use multiple-precision.

How to use Convert2FM

This file discusses how to use the Convert2FM program.

Example conversion

fmin.f95 is a standard Fortran program that uses double precision and finds max/min points for functions.

fmin.chk is the expected output. Different compilers might give slightly different numbers.

As is typical for max/min problems, the function values at the extreme points have been found
to full double precision, but the corresponding x-values are accurate to only about half the
digits being carried.

The double precision declarations in fmin.f95 have been changed to REAL (KIND(3.1D1)) so that
Convert2FM will change them to TYPE (FM) multiple precision. Several comments like
! CHARACTER(80) :: ST1,ST2
have been added to show where the changes were made by hand in the final fminFMv2.f95 version.

fminFM.f95 is the program that results from running Convert2FM with fmin.f95 as input.

fminFM.chk is the expected output from this program. The results are printed to double precision
accuracy, but now that FM is being used for the arithmetic, both x and f(x) values are accurate.

fminFMv2.f95 is the program that results from making some changes by hand to fminFM.f95.
Most of these are to convert output formats to print more digits than double precision carries.

fminFMv2.chk is the expected output from this program. The results are printed with about 25
significant digits, and since the arithmetic has been done with over 50 significant digits, the
digits shown are accurate.

Back to the main FM page