HP Pascal/iX Reference Manual (31502-90022)

3- 10
$standard_level 'hp_modcal'$
program prog(output);
var q:longint;
begin
{ one way to get longint constants >= 2 ** 31 or < - 2 ** 31 }
$push; type_coercion 'conversion'$
q:=longint(123456) * 1000000000 + 789012345;
$pop$
writeln(q);
end.
Output:
123456789012345
Shortint.
The predefined data type
shortint
is an integer in the range
-32768..32767 that is stored in 16 bits. (In contrast, if you declare a
variable to be in that range, it is stored in 32 bits.)
Permissible Operators
assignment :=
relational <, <=, =, <>, >=, >, IN
arithmetic +, -, *, /, DIV, MOD
Standard Functions
shortint argument - abs ln sin
arctan odd sqr
chr ord sqrt
cos pred succ
exp
shortint return - pred
succ
Standard Procedures
prompt strread
read strwrite
readdir writedir
readln writeln
Example
program short(output);
var q:shortint;
begin
q:=-1;
writeln('size of shortint = ',sizeof(q):1);
end.
Output:
size of shortint = 2
Subrange.