254
SDA-OM-E Rev H
Arithmetic Operators
As with most other languages, the arithmetic operators are used as follows:
^
Exponentiation
A ^ B = A
B
= A raised to the
power B
/
Division
A / B = A divided by B
\
Integer division
A \ B = A divided by B,
truncated to next integer below
*
Multiplication
A * B = A multiplied by B
+
Addition
A + B = B added to A
-
Subtraction
A B = B subtracted from A
Please Note the Following:
•
If there is any possibility that you will be taking the exponent of a negative number, make sure to trap any possible
errors arising from such operations as trying to take the square root of a negative number. Logs of negative numbers
are forbidden also.
•
If there is any possibility that you will be dividing by zero, make sure to trap this.
•
There are two ways of dealing with these types of problem. One is to prevent it happening by making suitable tests
before the calculation is performed. The other is to let it happen, and use an error handling routine. This will be
discussed later.
•
Normally in VBScript you will know the range of the data, since all the incoming data are, by definition, integer
(unscaled data) or real (scaled data), and they must fit into the screen of the instrument.
Results of Calculations
Sometimes you may see a statement like this:
A = A * A * (Cos (A) + Sin (A) )
The program takes the quantity represented by A and performs all of the following operations,
using that original value:
1. Multiply A by itself.
2. Calculate the cosine of A.
3. Calculate the sine of A.
4. Add the cosine and the sine together.
5. Multiply that result by the square of A.
At this point, the quantity represented by A has not been changed. Only at the end of the
calculation is the final value placed in the memory location labeled A.
Note that you can write more than one statement on a line, separated by colons, like this:
A = B * Cos (34 * Theta) * Sin (55 * Theta) : B = A * A + Z * Z
Summary of Contents for SDA
Page 1: ...SERIAL DATA ANALYZER OPERATOR S MANUAL December 2007 ...
Page 223: ...SDA Operator s Manual Example 6 SDA OM E Rev H 223 ...
Page 225: ...SDA Operator s Manual SDA OM E Rev H 225 ...
Page 246: ...246 SDA OM E Rev H ...
Page 247: ...SDA Operator s Manual Excel Example 5 Using a Surface Plot SDA OM E Rev H 247 ...
Page 279: ...SDA Operator s Manual Convolving two signals SDA OM E Rev H 279 ...
Page 310: ...The jitter wizard is accessed from the Analysis drop down menu 310 SDA OM E Rev H ...
Page 327: ...SDA Operator s Manual SDA OM E Rev H 327 ...
Page 328: ...328 SDA OM E Rev H ...
Page 394: ...394 SDA OM E Rev H ...