Calculator Command [=]
The calculator evaluates an expression and prints the result.
=expression [,O | D | B | H | A | # % $]
Any command that begins with an equal sign (=) is treated as an expression to be evaluated. An expression consists of numbers and operators, followed by an optional display format. The operators can be addition (+), subtraction (-), multiplication (*), division (/), or exponentiation (**). The value of the expression is printed immediately on Stdlist.
=20+15 {add two numbers together} Result=35.0 =20*15 {multiply the same numbers} Result=300.0 =20-15 {subtraction} Result=5.0 =20/15 {divide, print precise result} Result=1.33333333333 =20**15 {20 raised to the 15th power} Result=.327680000000E+20
Order of Evaluation
Unlike most programming languages, the calculator always evaluates the calculation from left to right. This is similar to an electronic calculator, where each keystroke is operated on immediately. You can use parentheses to force the calculator to evaluate the expression in a different order.
=14+16+15/3 {compute an average} Result=15.0 =14+16+(15/3) {add 14, 16, and the result of 15/3} Result=35.0 =14+((16+15)/3) {divide 16+15 by 3, then add to 14} Result=24.3333333333
Percentages
A number in the calculator expression may be followed by a percent sign (%). The calculator assumes that you want to qualify the number as a percentage.
=125*5% {what is 5% of 125} Result=6.25 =125+125*5% {add 5% of 125 to 125} Result=12.5 =125+(125*5%) {oops, we needed to change the order} Result=131.25 {this looks like the answer we wanted}
The last two examples show the importance of the order in which calculator evaluates the expression. We needed to use parentheses to force calculator to evaluate our expression in the correct order.
Display Formats
A calculator expression may be followed by a comma and a display letter. The default is decimal (#) and the options are Hex ($ or H), Octal (% or O), Double (D), ASCII (A) and Binary (B). With these options, the result is treated as a 32-bit integer.
=10,% {standard octal format} Result=%000012 =-10,% {negative number in octal} Result=%37777777766 =100,$ {hexadecimal} Result=$0064
In Double format, calculator prints the double result as two octal numbers. The first number represents the high-order 16-bits and the second number represents the low-order 16-bits.
=10,d {treat result as two 16-bit octal words} Result=%000000 %000012 =1000000000,d {high-order 16-bits are nonzero} Result=%035632 %145000 =-10,d {note negative value, 2's complement} Result= %177777 %177766
In ASCII format, up to four characters are printed in hexadecimal, decimal, and ASCII display format.
=$2020,a Result=$2020: 32,32 :" " =%20161 %72145,a Result=$2071: 32,113:" q" $7465:116,101:"te"
In Binary format, the high-order 16-bits are examined. If these bits are not zero, they are printed as two groups of eight bits. A one (1) means that the bit is on and a zero (0) means that the bit is off. The low-order 16-bits are always printed as two groups of eight bits.
=10,b {high-order 16-bits suppressed} Result=%(2)00000000 00001010 =-10,b {note negative value, 2's complement} Result=%(2)11111111 11111111 %(2)11111111 11110110 =1000000000,b {high-order 16-bits are nonzero} Result=%(2)00111011 10011010 %(2)11001010 00000000
Input Format
The calculator supports different input formats for numbers. Octal values are prefixed with a percent sign (%) and hexadecimal values with a dollar sign ($). Decimal is assumed by default, but decimal values may be prefixed with # if desired. An ASCII string of up to 4 characters is entered in quotes. The result of the last calculation is referred to using #.
=%12 {octal 12 or decimal 10} Result=10.0 =%12,o {octal input and octal display format} Result=%000012 =$10 Result=16.0 =%177766 {octal number that is really negative} Result=-10.0 ="abcd",h Result=$61626364 =#,a Result=$6162: 97,98 :"ab" $6364: 99,100:"cd"
Programmers who make use of octal dumps are often frustrated when 32-bit integers are printed as two 16-bit integers. To help with this problem, the calculator will accept two octal numbers as input and print the result in standard decimal format.
=%35632 %145000 {treat as one 32-bit integer value} Result=1000000000.0 =%177777 %177766 {negative 32-bit integer value} Result=-10.0
Calculator Help
The calculator offers a number of options. You can refresh your memory on the calculator’s abilities by entering
=? {? gives help} {prints a summary of = functions}