Returns integer information describing the computer’s arithmetic.
Synopsis
#include<imsls.h>
longimsls_i_machine (intn)
Required Arguments
intn (Input) Index indicating which value is to be returned. It must be between 0 and 12.
Return Value
The requested value is returned. If n is out of range, NaN is returned.
Description
Function imsls_i_machine returns information describing the computer’s arithmetic. This can be used to make programs machine independent.
imsls_i_machine(0) = Number of bits per byte
Assume that integers are represented in M-digit, base-A form as
where σ is the sign and 0 ≤xk < A for k = 0, …, M. Then,
n
Definition
0
C, bits per character
1
A, the base
2
Ms, the number of base-A digits in a short int
3
the largest short int
4
M1 the number of base-A digits in a long int
5
the largest long int
Assume that floating-point numbers are represented in N-digit, base B form as
where σ is the sign and 0 ≤xk < B for k = 1, …, N and Emin≤E≤Emax. Then
n
Definition
6
B, the base
7
Nf, the number of base-B digits in float
8
the smallest float exponent
9
the largest float exponent
10
Nd, the number of base-B digits in double
11
the largest long int
12
the number of base-B digits in double
Example
In this example, all the values returned by imsls_i_machine on a 32‑bit machine with IEEE (Institute for Electrical and Electronics Engineer) arithmetic are printed.