##### Calculator Overview

The Calculator feature available in KeyCreator can be used to evaluate algebraic expressions and set user-defined or system-reserved variables without leaving the software. A variable is a value that you name and store. It can contain certain types of data that you can modify while working in the program. Whenever you are asked for a value, you can use algebraic expressions rather than entering numbers on the Conversation bar.

The calculator can be invoked while you are already in a function (for example creating a line) and it will not exit out of that function. This makes it an immediate mode command; it temporarily suspends what you're doing to perform calculations or set variables. You can also enter an expression instead of a value, for example, 1/8 instead of .125.

NOTE: You can use the Calculator to convert units on the fly. For instance, if you were to open an inches file and use the Create>Line>By Endpoints function and enter a Key in value of "25.4mm" (for the X coordinate), that value would then automatically be converted to "1" (inch). Such a conversion will occur for all units and anywhere that the calculator-type edit field is displayed. Similarly, if you were to open a millimeter file and use the Create>Line>By Endpoints function and enter a Key in value of "1in" (for the X coordinate), that value would then automatically be converted to "25.4" (mm).

KXL also uses the same variable environment, so KXL and the program can share variables across their storage environments.

• The calculator range is +/- 1.798693e308.

• The calculator prioritizes algebraic operations, the same way BASIC, FORTRAN, C and most programming languages do. The priority of math operations is as follows: exponents, multiplication, division, addition, and subtraction. Use parentheses ( ) to change evaluation priorities.

• The operators and functions recognized by the calculator are equivalent to their counterparts in the C programming language. See the list under Math and Logical Operators.

• The calculator will accept measurement input in any of the units that the program supports. The value given will be converted to the appropriate value in the current units of the active part. These forms can be used anywhere a number would normally be used.

##### Example

The calculator will accept measurement input in any of the units that the program supports. An example of this is shown below.

Inches: 5" or 5 in or in(5)

Feet: 5' or 5 ft or ft(5)

Feet and Inches:  5' 5"

Yards: 5 yd or yd(5)

Millimeters: 5 mm or mm(5)

Centimeters: 5 cm or cm(5)

Meters: 5 m or m(5)

In other words, if the current part has units of millimeters, then the calculator will convert an input of 1" or in (1) to 25.4.

• If the current part has units of inches, then the calculator will convert an input of 10' 2.5" to 122.5.

• If the suffix form is used, the suffix only applies to the number directly preceding the suffix, and can only be used after a number, not an expression. Thus, 5 + 1 yd means 5 + yd(1), not yd(6), and (5 + 1) yd is an error. The prefix form can contain any expression inside the parenthesis. An input of in (1 + 2 * 3) is valid, and is the same as in (7).

• The ’r; and " are the only suffixes that can be combined without a ’r;+’ between them: 5’ 5" and 5 ft + 5 in are valid, but 5" 5’, 5’ 5 in, and 5 ft 5 in are not.