<>1 FIGURE FIGURE is a general-purpose calculator with memory. It supports the following operations: () - Grouping operations / - Division = - Assign value to variable & - Logical (bitwise) AND ^ - Exponentiation + - Addition ~ - Logical (bitwise) NOT - - Subtraction * - Multiplication ! - Logical (bitwise) OR Variable names are 1-6 alphanumerics (beginning with a letter), assigned by the user. There are 98 variable cells available to be assigned by the user, plus the predefined variable RESULT, which contains the result of the last expression. Numbers are expressed as .@; an "@" is used instead of the traditional "E" to support radices greater than 10. <> Additional information: <> <> ARITHMETIC CONSTANTS RADIX <> ASSIGNMENT INCLUDE TESTS <> CHAIN LOGICAL <> 2 ARITHMETIC FIGURE supports the usual arithmetic operations, as given in the pre- vious help. Parentheses are evaluated first, followed by the unary minus sign (as in "-1), exponentiations ("^"), multiplication and division ("*" and "/"), addition and subtraction ("+" and "-"), and assignments ("="). In addition to the usual operations, there are these extras: Name Use Precedence DIV Integer division Same as multiplication and division MOD Remainder Same as multiplication and division SIGN Extract sign Same as unary minus ABS Absolute value Same as unary minus Examples: Expression Value 12*5 60. 2+3*4 14. 12 DIV 7 1. 5 MOD 3 2. SIGN -23 -1. 2 ASSIGNMENT Definition of variables and the assignment of values to them is done as follows: variable = expression You can assign the same value to multiple variables using variable = variable = expression An assignment in parentheses is treated as a single value (the value of the expression), allowing you to save partial results. Examples: ANSWER = 12*5 X = Y = 3 Y = ((X=17/2)*5 + X)*3 + 1 2 CHAIN Stops processing the current input file, and starts processing the named file. The syntax is CHAIN "filename" Omitted elements of the filename default to <> SY:.FIG; <> SYS$DISK:[].FIG; Control is NOT returned to the file that issued the CHAIN. If issued at command level, CHAIN is treated as being the same as INCLUDE. 2 CONSTANTS Numeric constants are expressed in the form +/- whole . fraction @ +/- exponent where all parts of the number are unsigned integers in the current radix. If the signs are omitted, they are assumed "+". If the whole number part is zero, it may be omitted. If the whole number part is not omitted, and you are using a radix greater than 10, the whole number part must begin with a numeric character (0-9). If the frac- tional part is zero, it can be omitted, along with the decimal point (or radix point, if you want to be picky). If the exponent part is zero, you can omit both it and the "@" sign. The system also recognizes the following predefined constants: Name Value (in decimal) ------ ------------------ FALSE 0. TEN 10. TRUE -1. 2 INCLUDE Suspends processing the current input file, and starts processing the named file in a nested fashion. The syntax is INCLUDE "filename" or @ filename Omitted elements of the filename default to <> SY:.FIG; <> SYS$DISK:[].FIG; Control is returned to the file that issued the INCLUDE when the end of the INCLUDEd file is encountered. INCLUDE files can be nested up to 3 deep. 2 LOGICAL FIGURE supports three bitwise logical operations - "AND" (&), "OR" ("!"), and NOT ("~"). When evaluating expressions, AND has the same precedence as multiplication and division, OR has the same precedence as addition and subtraction, and NOT has the same precedence as the unary minus. Since FIGURE stores all values as REAL*4, they are converted to scaled integers for the bitwise logical operations. For AND and OR, the operands are aligned by shifting the smaller one to the right; the high bit is treated as a sign bit and propagated. Then, the bitwise operation is performed. For NOT operations, all bits are flipped, and the result is ANDed with the value in the special variable TRIM. Finally, the result is converted back to a REAL*4 number. Examples (all in decimal): Expression Value Expression Value 10&3 2. ~1 -2. -2!1 -1. 12.5&-1 12. <> Additional information: TRIM <> 3 TRIM TRIM is a predefined variable which is implicitly ANDed to the result of any NOT operation. It was found that the "turning on" of bits to the right of the decimal point by the NOT operation produced unde- sirable side effects (~1 was -1, not -2 as you would expect), and a mechanism for turning off the undesired bits was needed. The initial value of TRIM is -1, which forces the result of the NOT operation to be a whole number. It is recommended that TRIM be set only to values of the form -(2^n) where "n" is a positive or negative whole number. TRIM can also be set to zero, which is a special case that turns off the bit trimming feature 2 RADIX FIGURE supports entry and display of results in any radix from 1 through 36. All information is stored internally in binary, so the validity of stored data is unaffected by changing radix. Radix 1 is a special case, that displays the logical values "TRUE" and "FALSE". The output radix and default input radix are determined by the value of the predefined variable "RADIX". RADIX is assigned a value in the same manner as any other variable. The default radix can be overridden on input by temporary radix oper- ators. These are of the form %B - Binary %O - Octal %D - Decimal %X - Hexadecimal %n - Use the given number (in decimal) as the radix If used before a numeric constant, the temporary radix operator refers only to that constant. If used before parentheses, it refers to all numeric constants inside the parentheses. 2 TESTS FIGURE has the ability to do logical tests. These are performed AFTER addition and subtraction, but before assignments. The result of a test is TRUE (-1.) if the condition is met, or FALSE (0.) if not. Legal syntax is: value 1 =? value 2 TRUE if the two are equal value 1 >? value 2 TRUE if Value 1 is greater than Value 2 value 1 =? value 2 TRUE if Value 1 is greater than or equal to Value 2 value 1 <=? value 2 TRUE if Value 1 is less than or equal to Value 2 value 1 <>? value 2 TRUE if the two are not equal