MACHINE, an R library which returns machine constants, particularly those related to arithmetic with double precision real and integer quantities.
MACHINE is not an "intelligent" program; it's simply a way to store and retrieve the information necessary to describe the arithmetic performed on a given computer. Therefore, if you plan to use MACHINE on a particular kind of computer, you must verify that the values being returned are appropriate.
One way to do this is to run the program MACHAR which is an "intelligent" program that actually tries to determine machine arithmetic properties dynamically.
MACHINE uses some simple conventions to describe how integers and real numbers are stored on an arbitrary computer.
MACHINE assumes that integers are represented using S digits in base A:
Sign * ( X(S-1)*A^(S-1) + ... + X(1)*A + X(0))
MACHINE assumes that real numbers are represented using a mantissa T, base B and exponent E as:
Sign * T * B^{E}
D1MACH returns quantities associated with double precision arithmetic, including:
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 computer code and data files described and made available on this web page are distributed under the MIT license
machine is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version and an R version.