MACHAR
Dynamically Compute Machine Constants
MACHAR
is a C++ library which
dynamically computes constants that
characterize the floating point arithmetic system on a computer,
by William Cody.
This includes
the value of the "machine epsilon", the smallest number that can
be added to 1 and make a difference. However, it includes many
other quantities of interest, including the arithmetic base,
the largest and smallest magnitudes, and so on.
The FORTRAN77 version of these routines was supplied as part of ACM
TOMS algorithm 665.
A C version of these routines was supplied as part of ACM
TOMS algorithm 722.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
MACHAR 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:
MACHINE,
a C++ library which
stores the appropriate values
of machine constants for a given machine.
Author:
Original FORTRAN77 version by William Cody.
C++ version by John Burkardt.
Reference:

William Cody,
Algorithm 665:
MACHAR, a subroutine to dynamically determine
machine parameters,
ACM Transactions on Mathematical Software,
Volume 14, Number 4, December 1988, pages 303311.

William Cody, William Waite,
Software Manual for the Elementary Functions,
Prentice Hall, 1980,
ISBN: 0138220646,
LC: QA331.C635.

Morven Gentleman, Scott Marovich,
More on Algorithms that Reveal Properties of Floating Point
Arithmetic Units,
Communications of the ACM,
Volume 17, Number 5, May 1974, pages 276277.

Michael Malcolm,
Algorithms to Reveal Properties of Floating Point Arithmetic,
Communications of the ACM,
Volume 15, Number 11, November 1972, pages 949951.
Source Code:
Examples and Tests:
List of Routines:

R4_ABS returns the absolute value of an R4.

R4_MACHAR computes machine constants for floating point arithmetic.

R8_ABS returns the absolute value of a double precision number.

R8_MACHAR computes machine constants for double floating point arithmetic.

TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the C++ source codes.
Last revised on 11 November 2006.