30.07.2013 Views

T-FLEX Parametric CAD. Fundamentals. 2D Design

T-FLEX Parametric CAD. Fundamentals. 2D Design

T-FLEX Parametric CAD. Fundamentals. 2D Design

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Fundamentals</strong>. Two-Dimensional <strong>Design</strong><br />

494<br />

subtraction ( - )<br />

multiplication ( * )<br />

division ( / )<br />

unary negation (minus).<br />

Examples of correctly defined expressions (followed by the result after the “=” sign):<br />

2 + 3 = 5<br />

5 - 9 = -4<br />

Do not divide by zero. This will result in an error.<br />

Use of “unary negation” operation is illustrated by the following example. Suppose, VAR_1 is equal to 5,<br />

then the following expression yields:<br />

- VAR_1 = -5<br />

An arbitrary number of spaces are allowed in expressions, for example,<br />

5 * 3 + 2 = 17<br />

Spaces make expressions more readable.<br />

An important issue is the order of operations (precedence).<br />

Thus, the resulting value of the following expression,<br />

2 + 3 * 4<br />

will be 14, rather than 20, because multiplication operation has higher precedence than addition. To change<br />

the order of operations, use parentheses. The previous expression can be modified in the following way in<br />

order to yield 20:<br />

( 2 + 3 ) * 4<br />

Proper use of parentheses helps avoiding unexpected results.<br />

Power of ( ** or ^ )<br />

Example:<br />

2 ** 3 = 8<br />

-3 ** 3 = -27<br />

The following examples demonstrate specifics of this operation:<br />

0 ** 17 = 0 (zero to any power is zero).<br />

23 ** 0 = 1 (any value to the power of zero is one).<br />

Errors may occur on evaluating this operation. The following message is output in such a case: “illegal<br />

power function in line 1”.<br />

Errors occur in the following cases:<br />

-2 ** 3.4 (an attempt to raise a negative value to a fractional power).<br />

23 ** 234344 (overflow error due to too large resulting value).<br />

Modulo division ( % )<br />

Example:<br />

23 % 5 = 3<br />

23.7 % 5.5 = 1.7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!