Professor of Mathematics (Emeritus)

Loyola Marymount University

Los Angeles, CA

** News:
**

**
**

** January, 2018: **

This multiple precision web site has been moved to a new server. | |

The old site at http://myweb.lmu.edu/dmsmith/FMLIB.html has been shut | |

down, and any reference to any of the pages at the old myweb site | |

should now be automatically re-directed to this page on the new server: | |

http://dmsmith.lmu.build |

** November, 2017: **

There is a new version for the Calc-50 high-precision calculator app | |

for iPhones and iPads. Version 1.1 has added a new screen of functions | |

for graphing, sums, products, and differential equations. | |

There is also a new page of examples showing some more advanced ways | |

to use the programming capabilities of the calculator. | |

Calc-50 |

** October, 2017: **

Many of the files have new code that works around the Mac gfortran | |

bug in versions 6.1 -- 6.4. The gfortran developers say it should be | |

fixed in 6.5, but since 6.3 is currently the latest version available | |

as a Mac download, it could be a while before 6.5 appears. | |

They suggested a way to avoid the problem by initializing the | |

array-valued functions within FM. This version should still work | |

on compilers that do the initializations correctly. | |

The zip file below has the updated version of all the files. |

** August, 2017: **

All the source code and sample output files from the various pages of | |

this site have now been put into one zip file. | |

This is the May, 2017 version of the package -- there have been | |

a few minor changes to several of the routines since the 2016 version. | |

Mac gfortran (macOS Sierra (10.12): download gfortran 6.3) | |

at https://gcc.gnu.org/wiki/GFortranBinaries has a bug that causes some | |

FM programs to fail, including SampleFM.f95, TestFM.f95, and 7 of | |

the programs on the FM Sample Programs page. | |

It affects functions that return array function values of types (FM), | |

(IM), (ZM), etc. This includes cases like A = B + C, where the | |

variables are multiple precision vectors or matrices. | |

In SampleFM, for example, the package detects that in the Sample10 | |

case, the compiler has not properly initialized a multiple precision | |

array associated with the function value. The program then prints | |

an error message and stops. | |

gfortran 5.2 was the last version I tested that was ok. There is a | |

gfortran 6.1 version, but I haven't tested it. | |

Version 6.4 has just been released, but the bug has not yet been fixed | |

The gfortran developers say it should be fixed in version 6.5. |

** January, 2017: **

And now for something completely different: | |

a 50-digit calculator app for iPhones and iPads. | |

Calc-50 |

** July, 2016: **

Three new modules are available that allow programs to work with FM | |

when they explicitly declare some variables to be quadruple precision | |

real or complex (128 bits), double length integer (64 bits), or | |

quadruple length integer (128 bits). | |

These modules are more general and can be more flexible for interfacing | |

multiple precision type (fm), (im), or (zm) variables with user variables | |

of these other three kinds. | |

See below for a link to a page for these three modules. |

** March, 2016: **

A new package is available for multiple-precision exact rational | |

arithmetic. See below for a link to a page for the files that define | |

the package. Many of the other files here have changed, with some | |

new code to support the rational arithmetic routines. | |

Several files on the sample program page have also changed. |

** July, 2015: **

Some changes have been made to FM to support programs that need | |

64-bit integer arithmetic. This version works with either 64-bit or | |

32-bit integers. | |

This version can be useful even for programs that don't need 64-bit | |

integers if having extended FM over/underflow thresholds is useful. | |

See the "Installing the FM package" section of file FM_User_Manual.txt | |

below for more details. |

This page has some older FM news items.

The package performs multiple-precision real, complex, and integer arithmetic.

It provides the intrinsic Fortran numerical functions, as well as many special functions that are

not included in the Fortran standard.

In addition to these three basic arithmetic types, multiple-precision exact rational arithmetic

and interval arithmetic are also available.

One of the primary uses of the package is to study the accuracy and stability of numerical

algorithms by comparing results computed with several different levels of precision.

An existing Fortran program can be checked by converting it from double precision

to FM arithmetic. The package is designed to make this conversion fairly easy.

The precision, base, and rounding mode for the arithmetic can be set by the user.

Functions are available for conversion between multiple-precision numbers and machine-precision

numbers (single and double precision real and complex, and integer types). Mixed-mode operations

involving multiple-precision numbers and machine-precision numbers are handled automatically in

statements such as a = b - 1 or y = x/3.

There are functions for input/output operations and output formatting. Formatting functions are

very similar to Fortran's format specifications.

The package also has routines for integer multiple-precision arithmetic and functions, including

GCD, modular products and powers, and a random number generator based on 49-digit primes.

Array syntax works like Fortran's array operations in statements like v = 1, a = b + c, and

y = cos(x) when these variables are vectors or matrices of multiple precision numbers.

The program SampleFM.f95 below shows several examples of using FM for high-precision real,

complex, and integer calculations.

**
**

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

website: FM_files.zip

The individual file pointers here display as pdf files for browsing. The longer files are cut

off after 20 pages.

** **

FM.f95

Subroutine library for multiple-precision operations. 64,738 lines of code

FMZM90.f95

Module for derived type interfaces. 49,781 lines of code

FMSAVE.f95

Module for FM internal global variables. 488 lines of code

TestFM.f95

Test program that checks a few operations for all of the FM routines. 43,964 lines of code

SampleFM.f95

Small sample program using FM. 893 lines of code

SampleFM.chk

Expected output file from SampleFM.f95. 157 lines

FM_User_Manual.txt

User's Guide for the package, along with a list of the files, some troubleshooting advice,

and an example set of compiler/linker commands for building the programs. 2,532 lines

All of these are technical papers explaining the algorithms used by the multiple-precision

package, except the last one.

"Using Multiple-Precision Arithmetic" gives some samples and discusses the package

from a user's point of view.

Efficient Multiple-Precision Evaluation of Elementary Functions

Mathematics of Computation 52 (1989) 131 -- 134

A Fortran Package For Floating-Point Multiple-Precision Arithmetic

Transactions on Mathematical Software 17 (1991) 273 -- 283

A Multiple-Precision Division Algorithm

Mathematics of Computation 66 (1996) 157 -- 163

Multiple Precision Complex Arithmetic and Functions

Transactions on Mathematical Software 24 (1998) 359 -- 367

Multiple-Precision Gamma Function and Related Functions

Transactions on Mathematical Software 27 (2001) 377 -- 387

Multiple-Precision Exponential Integral and Related Functions

Transactions on Mathematical Software 37 (2011) 1 -- 18

A Multiple-Precision Interval Arithmetic Package

http://dmsmith.lmu.build/FMinterval2014.pdf (2014) 1 -- 13

Using Multiple-Precision Arithmetic

Computing in Science and Engineering 5 (July, 2003) 88 -- 93

This page has the code for the FM rational arithmetic package,

along with several sample programs that use the package and a user's manual.

This page has the code for the FM interval arithmetic package,

along with several sample programs that use the package and a user's manual.

This page has three modules that allow programs to work with FM when they explicitly

declare some variables to be quadruple precision real or complex, double length integer,

or quadruple length integer.

There is a test program for each module, a sample program that uses the modules and a user's

manual for the modules.

This page has a program that tries to automate most of the changes

needed to convert a normal Fortran program to a multiple-precision version using FM.

This page has a table of domains for FM functions.

This page has a table of times for FM functions.

This page has some example programs solving problems in root-finding,
linear systems of equations,

least-squares fitting, integrals, differential equations, derivatives for real and complex
functions, etc.