HP Pascal/iX Reference Manual (31502-90022)

9- 28
Numeric Conversion Functions
binary, hex, and octal are the three
numeric conversion functions
supported in HP Pascal.
binary, hex, and octal return an integer value. Therefore, all bits must
be specified if a negative result is desired. Alternatively, the
positive representation may be negated.
A description of each of these functions follows.
binary
Usage
binary
(s)
Argument
s
Any string or PAC expression whose range is implementation
dependent.
Description
The binary function converts a string or PAC expression that is
interpreted as a
binary
value to an integer. Leading and trailing blanks
are ignored in the argument. It is an error if any character is not a
legal binary digit; for example, 0..1.
Example
Input Result
binary(strng) depends on the value of strng
binary('10011') 19
-binary('10011') -19
NOTE If your particular implementation uses 32-bit 2's complement
notation, the following example also works:
binary('11111111111111111111111111101101') = -19
hex
Usage
hex
(s)
Argument
s
Any string or PAC expression whose range is implementation
dependent.
Description
The hex function converts a string or PAC expression, that is interpreted
as a
hexadecimal
value to an integer. Leading and trailing blanks are
ignored. It is an error if any character is not a legal hex digit; for
example, 0..9, 'A'..'F', or 'a'..'f'.