Data Storage Formats [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation
SPL to HP C/XL Migration Guide
Data Storage Formats
SPL processes six types of data.
Table 3-1. Data Types
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| INTEGER | short int |
| | |
---------------------------------------------------------------------------------------------
| | |
| DOUBLE | long int OR int (equivalent in HP C/XL) |
| | |
---------------------------------------------------------------------------------------------
| | |
| REAL | float |
| | |
---------------------------------------------------------------------------------------------
| | |
| LONG | double |
| | |
---------------------------------------------------------------------------------------------
| | |
| BYTE | unsigned char OR unsigned short int |
| | (depends on usage) |
| | |
---------------------------------------------------------------------------------------------
| | |
| LOGICAL | unsigned short int |
| | |
---------------------------------------------------------------------------------------------
The HP C/XL types float, double, unsigned char, and unsigned short int
are not precise equivalents for the SPL types REAL, LONG, BYTE, and
LOGICAL. The differences are described below.
INTEGER Format
Table 3-2. INTEGER Format
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| Type: INTEGER | Type: short int |
| | |
---------------------------------------------------------------------------------------------
| | |
| 16-bit signed integer in two's-complement | Same as SPL. |
| form. | |
| | |
---------------------------------------------------------------------------------------------
| | |
| Range is -32768 to 32767. | Same as SPL. |
| | |
---------------------------------------------------------------------------------------------
DOUBLE Integer Format
Table 3-3. DOUBLE Integer Format
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| Type: DOUBLE | Type: long int OR int (equivalent) |
| | |
---------------------------------------------------------------------------------------------
| | |
| 32-bit signed integer in two's-complement | Same as SPL. |
| form. | |
| | |
---------------------------------------------------------------------------------------------
| | |
| Range is -2,147,483,648 to 2,147,483,647. | Same as SPL. |
| | |
---------------------------------------------------------------------------------------------
REAL Format
Table 3-4. REAL Format
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| Type: REAL | Type: float |
| | |
---------------------------------------------------------------------------------------------
| | |
| 32 bits (two words) in MPE V floating-point | 32 bits (one word) in IEEE floating-point |
| format: | format: |
| 1-bit sign, 9-bit exponent, 22-bit | 1-bit sign, 8-bit exponent, 23-bit |
| fraction. | fraction. |
| | |
---------------------------------------------------------------------------------------------
| | |
| Approximate nonzero range: | Approximate nonzero range: |
| Ý8.63617x10-78 to Ý1.157921x1077 | Ý1.754944x10-38 to Ý3.4028235x1038 |
| | |
---------------------------------------------------------------------------------------------
CAUTION The numeric ranges AND the data storage formats for SPL and HP
C/XL 32-bit floating-point data are significantly different. If
your application uses REAL floating-point data that depend on
extreme values, bit manipulation, or file storage, you may have
a problem in migrating to HP C/XL.
However, floating-point values may be translated from MPE V
format to MPE XL format and back with the MPE XL HPFPCONVERT
intrinsic. See the MPE XL Intrinsics Reference Manual for
details.
LONG Format
Table 3-5. LONG Format
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| Type: LONG | Type: double |
| | |
---------------------------------------------------------------------------------------------
| | |
| 64 bits (four words) in MPE V | 64 bits (two words) in IEEE floating-point |
| floating-point format: | format: |
| 1-bit sign, 9-bit exponent, 54-bit | 1-bit sign, 11-bit exponent, 52-bit |
| fraction. | fraction. |
| | |
---------------------------------------------------------------------------------------------
| | |
| Approximate nonzero range: | Approximate nonzero range: |
| Ý8.63618555094445x10-78 | Ý2.2250738585072014x10-308 |
| to Ý1.157920892373162x1077 | to Ý1.79769313486231x10308 |
| | |
---------------------------------------------------------------------------------------------
CAUTION The numeric ranges AND the data storage formats for SPL and HP
C/XL 64-bit floating-point data are significantly different. If
your application uses LONG floating-point data that depend on
bit manipulation or file storage, you may have a problem in
migrating to HP C/XL.
However, floating-point values may be translated from MPE V
format to MPE XL format and back with the MPE XL HPFPCONVERT
intrinsic. See the MPE XL Intrinsics Reference Manual for
details.
BYTE Format
Table 3-6. BYTE Format
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| Type: BYTE | Type: unsigned char OR unsigned short int |
| | (depends on usage) |
| | |
---------------------------------------------------------------------------------------------
| | |
| 8-bit character stored in high-order byte | 8-bit character OR 16-bit unsigned integer |
| of 16-bit word. | |
| | |
---------------------------------------------------------------------------------------------
In SPL BYTE format, characters are stored as 8-bit bytes, two to a 16-bit
word. A single or odd character occupies the high-order byte of the
word.
Normally, the HP C/XL unsigned char data type is the correct choice for
conversion of both simple BYTE variables and BYTE arrays.
However, a simple BYTE variable may also be used as a 16-bit quantity in
many places where an INTEGER or LOGICAL data type is accepted. In that
usage, the value is more like an HP C/XL unsigned short int with the
character value in the high-order byte.
In the conversion, such uses need to be clearly identified. If the
variable is used for both 8-bit and 16-bit operations, it would be wise
to divide the uses into separate variables.
LOGICAL Format
Table 3-7. LOGICAL Format
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| Type: LOGICAL | Type: unsigned short int |
| | |
---------------------------------------------------------------------------------------------
| | |
| 16-bit unsigned integer, ranging from 0 to | Same as SPL. |
| 65535. | |
| | |
---------------------------------------------------------------------------------------------
| | |
| In a conditional test, a LOGICAL, BYTE, or | In a conditional test, a numeric value of |
| INTEGER value is true if it is odd, that | any type is true if it is nonzero. It is |
| is, if bit 15 is on. It is false if it is | false if it is zero. |
| even, that is, if bit 15 is off. | |
| | |
---------------------------------------------------------------------------------------------
| | |
| The logical constant TRUE equals 65535 (all | HP C/XL has no identifiers for true and |
| 16 bits on); FALSE equals 0 (all 16 bits | false. The result of a relational |
| off). | expression is 1 if true, 0 if false. |
| | |
---------------------------------------------------------------------------------------------
MPE/iX 5.0 Documentation