12/07/88 calc Syntax: calc {expression} Syntax as an active function: [calc expression] Function: provides you with a calculator capable of evaluating arithmetic expressions with operator precedence, a set of often-used functions, and a memory that is symbolically addressable (i.e., by identifier). Arguments: expression is an arithmetic expression to be evaluated. If this argument is specified, the calc command prints its value and returns to command level. The expression must be quoted if it contains spaces or other command language characters. Variables are not allowed. List of requests: prints out the value of expression. = assigns value of expression to variable. list prints out the names and values of all the variables that have been declared so far. prints out the name and value of variable. q returns to command level. . causes calc to identify itself by printing "calc". .. causes the remainder of the line to be passed to Multics as a command line and executed. Notes: Invocation of calc with a newline enters calculator mode. You can then type in expressions, assignment statements, or list requests, separated from each other by one or more newline characters. All of these operations are described below. You must use the quit request with a newline character to return to command level. Notes on expressions: Arithmetic expressions involve real values and the operands +, -, *, /, and ** (addition, subtraction, multiplication, division, and exponentiation). A prefix of plus (+) or minus (-) is allowed. Parentheses can be used, and blanks between operators and values are ignored. Calc evaluates each expression according to rules of precedence and prints out the result. The quit request (followed by a newline character) returns you to command level. The order of evaluation is as follows: expressions within parentheses function references prefix +, prefix - ** *, / +, - For example, if you type 2 + 3 * 4 calc responds = 14 Operations of the same level are processed from left to right except for the prefix plus and minus, which are processed from right to left. This means 2**3**4 is evaluated as (2**3)**4. Numbers can be integers (123), fixed point (1.23) and floating point (1.23e+2, 1.23e2, 1.23E2, or 1230E-1). All are stored as float bin(27). An accuracy of about seven figures is maintained. Variables (see below) can be used in place of constants, e.g., pi * r ** 2. Seven functions are provided--sin, cos, tan, atan, abs, ln, and log (ln is base e, log is base 10). They can be nested to any level, e.g., sin(ln(var).5*pi/180). Notes on assignment statements: The value of an expression can be assigned to a variable. The name of the variable must be from one to eight characters and must be made up of letters (uppercase and/or lowercase), digits (if not at the beginning of the name), and the underscore character (_). The form is = For example, the following are legal assignment statements-- x = 35 Rho = sin(2*theta) The calc command does not print any response to assignment statements. The variables "pi" and "e" have preassigned values of 3.14159265 and 2.7182818, respectively. ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved