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
ABS (Source)
Returns the absolute value of a number.
Syntax
x = ABS (source)
Remarks
Source 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).
Содержание CR5000
Страница 39: ...Section 1 Installation and Maintenance 1 15 S A N Y O FIGURE 1 11 6 Removal of band clamp and battery ...
Страница 40: ...Section 1 Installation and Maintenance 1 16 This is a blank page ...
Страница 54: ...Section 2 Data Storage and Retrieval 2 14 This is a blank page ...
Страница 88: ...Section 4 CRBasic Native Language Programming 4 12 This is a blank page ...
Страница 94: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 172: ...Section 7 Measurement Instructions 7 46 This is a blank page ...
Страница 206: ......
Страница 236: ...Index Index 4 This is a blank page ...
Страница 237: ...This is a blank page ...