AMACH
The function subprogram AMACH retrieves machine constants that define the computer’s single-precision or double precision arithmetic. Such floating-point numbers are represented in normalized N-digit, base B form as
where σ is the sign, 0 < x1 < B, 0  xk < B, k = 2, N and
Function Return Value
AMACH(1) = , the smallest normalized positive number.
AMACH(2) = , the largest number.
AMACH(3) = , the smallest relative spacing.
AMACH(4) = , the largest relative spacing.
AMACH(5) = .
AMACH(6) = NaN (non-signaling not a number).
AMACH(7) = positive machine infinity.
AMACH(8) = negative machine infinity.
See Comment 1 for a description of the use of the generic version of this function.
See Comment 2 for a description of min, max, and N.
Required Arguments
I — Index of the desired constant. (Input)
FORTRAN 90 Interface
Generic: AMACH (I)
Specific: The specific interface names are S_AMACH and D_AMACH.
FORTRAN 77 Interface
Single: AMACH (I)
Double: The double precision name is DMACH.
Comments
1. If the generic version of this function is used, the immediate result must be stored in a variable before use in an expression. For example:
X = AMACH(I)
Y = SQRT(X)
must be used rather than
Y = SQRT(AMACH(I)).
If this is too much of a restriction on the programmer, then the specific name can be used without this restriction.
2. Note that for single precision B = IMACH(6), N = IMACH(7).
Emin = IMACH(8), and Emax = IMACH(9).
For double precision B = IMACH(6), N = IMACH(10).
Emin = IMACH(11), and Emax = IMACH(12).
3. The IEEE standard for binary arithmetic (see IEEE 1985) specifies quiet NaN (not a number) as the result of various invalid or ambiguous operations, such as 0/0. The intent is that AMACH(6) return a quiet NaN. On IEEE format computers that do not support a quiet NaN, a special value near AMACH(2) is returned for AMACH(6). On computers that do not have a special representation for infinity, AMACH(7) returns the same value as AMACH(2).