| SimCon Home | Ref Manual Home |

The Derived Types Used in Emulation

Single Component Derived Types

The single component derived types shown below were used in the study of real precision described here. The overloaded arithmetic operators and intrinsic functions were used to manipulate the precision of the real and complex numbers.

The programs in this study use two kinds of real and complex numbers, 4 and 8-byte IEEE numbers with the parameterised type values  kr4  and  kr8.

! ***************************************************************************** ! em_types.i90 7-Sep-15 John Collins ! ***************************************************************************** ! Note that all types are sequence derived types so that the variables ! can be in COMMON ! TYPE em_real_k4 SEQUENCE REAL(KIND=kr4) value END TYPE em_real_k4 ! TYPE em_real_k8 SEQUENCE REAL(KIND=kr8) value END TYPE em_real_k8 ! TYPE em_complex_k4 SEQUENCE COMPLEX(KIND=kr4) value END TYPE em_complex_k4 ! TYPE em_complex_k8 SEQUENCE COMPLEX(KIND=kr8) value END TYPE em_complex_k8 ! PUBLIC em_real_k4 PUBLIC em_real_k8 PUBLIC em_complex_k4 PUBLIC em_complex_k8 ! End of em_types.i90 *********************************************************

 

Two Component Types

The two-component types shown below are intended for a study of units and dimensions, but may also be useful in precision studies. The second component of each type is a 4-byte integer handle which indexes a data structure used to maintain the attributes of the real and complex numbers. In the study of units and dimensions, the data structure records contain the units and dimensions of the numbers and in a precision study they index the numbers of mantissa and exponent bits.

The attrib component of the emulation types is not initialised within the type definition so that variables of the types may be in COMMON blocks. Code is automatically added to the program to initialise this component.

! ***************************************************************************** ! em_types.i90 7-Sep-15 John Collins ! ***************************************************************************** ! Note that all types are sequence derived types so that the variables ! can be in COMMON ! TYPE em_real_k4 SEQUENCE REAL(KIND=kr4) :: value INTEGER(KIND=ki4) :: attrib END TYPE em_real_k4 ! TYPE em_real_k8 SEQUENCE REAL(KIND=kr8) :: value INTEGER(KIND=ki4) :: attrib END TYPE em_real_k8 ! TYPE em_complex_k4 SEQUENCE COMPLEX(KIND=kr4) :: value INTEGER(KIND=ki4) :: attrib END TYPE em_complex_k4 ! TYPE em_complex_k8 SEQUENCE COMPLEX(KIND=kr8) :: value INTEGER(KIND=ki4) :: attrib END TYPE em_complex_k8 ! PUBLIC em_real_k4 PUBLIC em_real_k8 PUBLIC em_complex_k4 PUBLIC em_complex_k8 ! End of em_types.i90 *********************************************************

File Handling

The type definitions are written in an  INCLUDE  files included in the emulation module.

 

Copyright ©1995 to 2018 Software Validation Ltd. All rights reserved.