Lesson 1: CALC [ MPE V to MPE XL: Getting Started ] MPE/iX 5.0 Documentation
MPE V to MPE XL: Getting Started
Lesson 1: CALC
With the new MPE XL command CALC you can use the operating system as an
online calculator. CALC evaluates an expression and stores the result in
the system variable HPRESULT.
The answer to any numerical problem is displayed as a decimal numeral
first, as a hexadecimal numeral second, and as an octal numeral last.
NOTE MPE XL only recognizes whole numbers.
CALC 1.5+2
^
ILLEGAL CHARACTER FOUND, EXPECTED A NUMBER.
(CIERR 9810)
Examples:
* Whole number evaluations
_________________________________________________________________
| |
| |
| :CALC 1+4 |
| 5, $5, %5 |
| |
| :CALC 10-4 |
| 6, $6, %6 |
| |
| :CALC 5*12 |
| 60, $3C, %74 |
| |
| :CALC 101/2 |
| 50, $32, %62 |
| |
| :SHOWVAR HPRESULT |
| HPRESULT = 50 |
| |
_________________________________________________________________
* String evaluation
________________________________________________________________
| |
| |
| :CALC 'abc'+'def' |
| abcdef |
| :SHOWVAR HPRESULT |
| HPRESULT = abcdef |
| |
________________________________________________________________
* Boolean evaluation
__________________________________________________________________
| |
| |
| :CALC 4=5 |
| FALSE |
| :SHOWVAR HPRESULT |
| HPRESULT = FALSE |
| |
__________________________________________________________________
NOTE Mixed expressions (for example, whole numbers and strings) are not
accepted; an error will result.
CALC 'a' + 2
^
ILLEGAL CHARACTER FOUND, EXPECTED A STRING
(CIERR 9815)
Exercises
1. Use the CALC command to do the following:
a. Add 3 and 4.
b. Evaluate the truth of 3=3.
c. Subtract `abc' from `abcdefg'.
MPE/iX 5.0 Documentation