HP Pascal/iX Programmer's Guide (31502-90023)
4: 2
| | 0, | |
| | 4.940656458412466*10-324..1.797693134862315*10308 | |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Real * | -3.402823*1038..-1.401298*10-45, | 32 |
| | 0, | |
| | 1.401298*10-45..3.402823*1038 | |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Shortint | -32768..32767 | 16 |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Longint | -263..263-1 | 64 |
| | | |
----------------------------------------------------------------------------------------------
* The range of values for longreal and real include denormalized
numbers.
NOTE HP and IEEE floating point numbers are identical. HP3000_16
floating point numbers are different from HP and IEEE floating
point numbers. For details, refer to the
Introduction to MPE XL
for MPE V Programmers
.
Bit16
The predefined data type
bit16
is a subrange, 0..65535, that is stored in
16 bits.
bit16
is a unique HP Pascal type because arithmetic operations
on
bit16
data are truncated to modulo 65535 when stored.
To determine if a type T is assignment compatible with
bit16
, treat
bit16
as a subrange of integer:
* If variable v is of type T and variable b16 is of type
bit16
, then
the assignment b16 := v is legal if the value of v is within the
range 0..65535.
* If the ranges of T and
bit16
do not overlap, the assignment b16 :=
v causes a compile-time error.
* If the ranges of T and
bit16
do overlap, but the value of v is
outside the range of
bit16
, then the assignment b16 := v causes a
run-time error.
Example
PROGRAM prog;
TYPE
T1 = integer; {overlaps bit16 range }
T2 = -32768..-1; {does not overlap bit16 range}
T3 = 0..65535; {overlaps bit16 range }
VAR
v1 : T1; {b16:=v1 may be legal, depending on value of v1}
v2 : T2; {b16:=v2 is never legal}
v3 : T3; {b16:=v3 is always legal}
b16 : bit16;
BEGIN {prog}
v1 := 65535;