Prev Next i1mach

Implementation of Cmlib i1mach Routine in Cpp

Syntax
j = i1mach_(i)

Purpose
This routine uses the C++ standard numeric_limits to implement the specifications required by the cmlib Fortran routine i1mach.

i
The argument i has prototype
     integer* 
i
It specifies which machine constant to evaluate.

d
The return value i has prototype % integer %d% % and is the value of the requested machine constant.

Mapping
The meaning for the machine constants below was extracted from the comments in the Fortran routine i1mach. The constants corresponding to i = 1, 2, 3, 4 are not defined. If any of these constants are requested, i1mach will generate an assertion error. Also note that, in the f2cad library, single and double precision Fortran values are both represented using C++ doubles. Hence, the return values for single and double precision are the same.
i j
1 standard input unit.
2 standard output unit.
3 standard punch unit.
4 standard error message unit.
5 number of bits per integer storage unit.
6 number of characters per integer storage unit.
7 base used for representation of integers.
8 number of base digits per integer storage unit.
9 largest integer magnitude
10 base for representing floating point numbers.
11 number of base digits in representation of single precision.
12 smallest exponent in representation of single precision.
13 largest exponent in representation of single precision.
14 number of base digits in representation of double precision.
15 smallest exponent in representation of double precision.
16 largest exponent in representation of double precision.

Input File: lib/i1mach.cpp