 
Quadruple precision
There are multipleprecision
(MP) software packages available when double precision is not adequate, but
these are extremely slow. Quadruple precision gives about twice as many
accurate digits as double precision and is much faster than MP.
 quad.f90
Module for quadruple precision arithmetic on PC's, using operator overloading.
This is designed for use with Lahey's LF90 compiler (you must use o0, i.e. no
optimization) or with Lahey's ELF90. For Compaq Visual Fortran 5.0 there is a
separate version, quad_df.f90,
of the main module now for Compaq which gives the same accuracy as Lahey's. This
version works with SOME Unix f90 compilers and with Absoft Pro Fortran
(Windows version) and NAS FortranPlus. For F (another subset of F90), Windows
95 version, there is quad.f. For the
Lahey/Fujitsu LF95 compiler, use the Compaq version. N.B. Quadruple precision is
built into LF95. It is easier to use than this version, and more accurate
(about 1.8 decimals), but slower.
I have learnt that Visual Basic sets the
FPU in the same way as LF90 and F. If you are calling DLL's compiled in
Fortran from VB, it may be necessary to use quad.f90 even though quad_df.f90
is the correct module for your Fortran compiler. This problem is likely to
occur with other mixed language programming. With the Portland PGF90 compiler,
I am told that you can use quad_df.f90, but you must use the undocumented
flags Kieee and PC 64, to `turn off optimization'.
 There is a short test program t_quad.f90,
for testing the basic arithmetic operations (+*/), and other test programs t_cubert.f90,
t_cst.f90
and t_logexp.f90
for testing logs, exponential and trigonometric functions. To test the F
version, use t_quad.f.
 qcomplex.f90
Module for complex quad. prec. arithmetic.
 From time to time I receive email messages telling me that the quad.
precision constants in my package are wrong. Before you do the same, look at
prtconst.f90.
 There are several example programs  hilbert.f90,
which inverts a 10 x 10 Hilbert matrix, long_gj.f90,
for GaussJordan elimination and sym_eig.f90
which finds the eigenvalues and vectors of a symmetric matrix using Kaiser's
method.
 q_erf.f90 is
a subroutine for calculating the error function and its complement in
quadruple precision. Use q_erf.f if you
are using F.
 q_lngam.f90
is a function for the log of the gamma function.
 hero.f90 A
program for calculating coefficients for halfHermite integration.
 Polynomial equations can be extremely difficult to solve, and this is one
place where extra precision is often required. q_pzeros.f90
is a module for solving polynomial equations, while q_poly20.f90
provides an example program. Requires the qcomplex module.
Click
here for more details, and a link to a multiple precision program.
I
am indebted to Keith Briggs (previouly at University of Cambridge) for access
to his package in C++ for quadruple precision which helped improve the
algorithm for calculating exponentials.
There is a newer package for doubledouble
precision and quaddouble precision (about 64 decimal digits accuracy) in C++,
which has a Fortran frontend, at Click here.
