=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= CALC v2.24 (C) 1987 Eric Hammond =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= CALC CALC CALC -- interactive multi-base expression evaluator. usage: CALC description: CALC is a program which will evaluate numerical expressions in any base and convert the answer to any base. The default input and output bases are both 10. Currently CALC can evaluate expressions involving parentheses and the following operators in the indicated precedence: 1. ( ) 2. ! (factorial) 3. - (unary negation) 4. ** (exponentiation - left to right) 5. * / % (mult, division, modulus - left to right) 6. + - (addition, subtraction - left to right) 7. & (bitwise and) 8. | ^ (bitwise or, bitwise xor - left to right) Division is integer division (decimal part is truncated). Negative numbers are displayed with a minus (-) in decimal and in two's complement in any other base. Numbers are also converted to two's complement for bitwise operations. Extra whitespace is ignored by CALC and case is of no importance. The largest integer value that CALC can handle may be determined by evaluating the following expression: 0|-1 commands: I nn The I command is used to set the input radix (base). This will be reflected in the prompt string. O nn The O command is used to set the output radix (base). This will be reflected in the evaluation string. expr If your input line starts with one of '0'-'9', 'A'-'F', '(', '-', CALC will assume it is a mathematical expression, and will try to evaluate it. P expr This is the same as the previous except that CALC will also display the postfix notation of the expression. R expr This allows you to evaluate an RPN (postfix) expression. The argument expr should be in RPN. ? For a short list of the commands type ? at the input prompt. X eXit CALC. CALC CALC example: C> CALC Calc v2.23 Type '?' for help. [10] : I 16 Input radix set to 16 [16] : O 2 Output radix set to 2 [16] : 5*(A-8)+3/2 [ 2] = 1011 [16] : O 10 Output radix set to 10 [16] : 0 | -1 [10] = 340282366920938463463374607431768211455 [16] : X C> _ caveats: * CALC will only accept and return integers. plans for future versions: * Handling of floating point numbers. * Your suggestions. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Version history of CALC: 01/ /87 1.00 Original version written in VAX Pascal. : : : 06/ /87 2.00 Converted to MS-DOS Turbo Pascal. : : : 06/30/87 2.20 Added capabilities for large numbers. Several bugs fixed. 06/30/87 2.21 Added unary negation. 06/30/87 2.22 Added factorial operator. 07/10/87 2.23 Converted to CP/M Turbo Pascal. Fixed minor bugs. 07/12/87 2.24 Fixed long multiplication algorythm. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Feel free to copy CALC and pass it on to others. If you have any questions, comments, suggestions, or have found any bugs in CALC, please contact: Eric Hammond 10040 Daly Rd. Cincinnati, OH 45231 Or, leave a message to Eric Hammond on the Cincinnati Osborne Group (COG) MBBS RCP/M. 513/481-1417 (2400/1200/300, 8, N, 1). =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=