8-1
Section 8. Processing and Math
Instructions
Operators
^
Raise to Power
*
Multiply
/
Divide
+
Add
-
Subtract
=
Equals
<>
Not
Equal
>
Greater
Than
<
Less
Than
>=
Greater Than or Equal
<=
Less Than or Equal
Absolute Value
Returns the absolute value of a number.
Syntax
Abs(
number
)
Remarks
The argument
number
can be any valid numeric expression. The absolute value of
a number is its unsigned magnitude. For example,
ABS(
-1
)
and
ABS(
1
)
both return
1.
Abs Function Example
The example finds the approximate value for a cube root. It uses Abs to determine
the absolute difference between two numbers.
Dim Precision, Value, X, X1, X2
'Declare variables.
Precision = .00000000000001
Value = Volt(3)
'Volt(3) will be evaluated.
X1 = 0: X2 = Value
'Make first two guesses.
'Loop until difference between guesses is less than precision.
Do Until
Abs(
X1 - X2
)
< Precision
X = (X1 + X2) / 2
If X * X * X - Value < 0 Then
'Adjust guesses.
X1 = X
Else
X2 = X
End If
Loop
'X is now the cube root of Volt(3).
Содержание CR9000
Страница 6: ...CR9000 Table of Contents iv This is a blank page ...
Страница 22: ...CR9000 Overview OV 16 This is a blank page ...
Страница 26: ...Section 1 Installation 1 4 CR9000 FIGURE 1 1 3 CR9000 Battery Pack ...
Страница 72: ...Section 3 CR9000 Measurement Details 3 28 This is a blank page ...
Страница 88: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 217: ...This is a blank page ...