MACHINE
Table of Machine Constants
MACHINE
is a FORTRAN77 library which
returns machine constants for integer and single and double precision quantities.
We assume that integer are represented using S digits in base A:
Sign * ( X(S-1)*A^(S-1) + ... + X(1)*A + X(0))
and that real numbers are represented using a mantissa T, base
B and exponent E as:
Sign * T * BE
D1MACH returns quantities associated with double precision
arithmetic, including:
-
B^(EMIN-1), the smallest positive magnitude.
-
B^EMAX*(1-B^(-T)), the largest magnitude.
-
B^(-T), the smallest relative spacing.
-
B^(1-T), the largest relative spacing.
-
log10(B)
I1MACH returns quantities associated with integer arithmetic,
as well as some integer quantities associated with real and
double precision arithmetic, and other machine-specific information.
-
the standard input unit.
-
the standard output unit.
-
the standard punch unit.
-
the standard error message unit.
-
the number of bits per integer storage unit.
-
the number of characters per integer storage unit.
-
A, the base for integers.
-
S, the number of base A digits in an integer.
-
A^S-1, the largest integer.
-
B, the base for single and double precision numbers.
-
T, the number of base B digits for single precision.
-
EMIN, the smallest exponent E for single precision.
-
EMAX, the largest exponent E for single precision.
-
T, the number of base B digits for double precision.
-
EMIN, the smallest exponent E for double precision.
-
EMAX, the largest exponent E for double precision.
R1MACH returns quantities associated with single precision
arithmetic, including:
-
B^(EMIN-1), the smallest positive magnitude.
-
B^EMAX*(1-B^(-T)), the largest magnitude.
-
B^(-T), the smallest relative spacing.
-
B^(1-T), the largest relative spacing.
-
log10(B)
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
MACHINE is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
MACHAR,
a FORTRAN77 library which
can compute machine
arithmetic quantities dynamically.
SLATEC,
a FORTRAN90 library which
includes MACHINE.
Reference:
-
Phyllis Fox, Andrew Hall, Norman Schryer,
Algorithm 528:
Framework for a Portable Library,
ACM Transactions on Mathematical Software,
Volume 4, Number 2, June 1978, page 176-188.
-
http://www.netlib.org/toms/528
the NETLIB web site for ACM TOMS algorithms.
Source Code:
Examples and Tests:
List of Routines:
-
D1MACH returns double precision machine constants.
-
I1MACH returns integer machine constants.
-
R1MACH returns single precision machine constants.
You can go up one level to
the FORTRAN77 source codes.
Last revised on 08 December 2007.