Using Quad Precision Real or Integer Variables with FM

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


Starting with the July, 2015 edition of FM, the user can use a compiler option to make
all the integer arithmetic have 64-bit precision in a program using FM. At that time,
the default precision for integers was 32 bits for most computers, so I will refer to
64-bit integers as double-length integers.

For floating-point real and complex variables, the default precisions available in 2015
were 32-bit single precision and 64-bit double precision. Some compilers supported 128-bit
quadruple precision floats and integers, usually done via software.

Some programs need to use several different precisions for their real and/or integer variables
while using FM. For those, automatically promoting the precision of all variables of a given
type by using a compiler option may not work.

This page gives 3 modules that allow programs to work with FM when they explicitly declare
some variables to be quad real, quad complex, double integer, or quad integer. The basic
module fmzm90.f95 already provided for single precision integer, real and complex, as well as
double precision real and complex.

The operations defined by these modules include assignments (a = x), comparisons (a < x),
and arithmetic (x = x + a), where one of a,x is type(fm), (im), or (zm), and the other is
quad real, quad complex, double integer, or quad integer.

These 3 modules are independent of each other. If a program uses quad reals but not double
or quad integers, then only the fm_quadreal.f95 file needs to be compiled and linked into
the program, and only that module needs USE statements in the program.

Not all compilers support all three of these precisions. The three TestFM... programs below
test the modules one at a time. The program SampleDQ.f95 uses all three.

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.

Files for the interface modules and test programs

Click a given file. If you directly download it, there may be an extra ".txt" filetype at the
end of the file name. Delete it. (You might also have to change "f95" to "f90" or something
else, depending on your compiler.)

Module for interfacing FM with quad precision real or complex variables. 11,639 lines of code

Module for interfacing FM with double length integer variables. 5,617 lines of code

Module for interfacing FM with quad precision integer variables. 5,617 lines of code

Checks operations for each of the fm_quadreal routines. 8,370 lines of code

Checks operations for each of the fm_doubleint routines. 4,892 lines of code

Checks operations for each of the fm_quadint routines. 4,892 lines of code

Small sample program using all three modules. 143 lines of code

Typical results from the program. Other compilers or computers may differ.

User's guide for these modules, along with a list of the files, and an example set of
compiler/linker commands for building the programs. 100 lines

Back to the main FM page