Abs(source), Acos (source) – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 289

Section 8. Processing and Math Instructions
ABS(Source)
Returns the absolute value of a number.
Syntax
ABS(source)
Remarks
The argument 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).
ACOS (Source)
The ACOS function returns the arc cosine of a number.
Syntax
x = ACOS (source)
Remarks
The source can be any valid numeric expression that has a value between -1 and
1 inclusive.
The ACOS function takes the ratio of two sides of a right triangle and returns
the corresponding angle. The ratio is the length of the side adjacent to the angle
divided by the length of the hypotenuse. The result is expressed in radians and
is in the range -
π
/2 to
π
/2 radians. If it is desired to use degrees instead of
radians for the inputs and results of the trig functions in a program, the
"AngleDegrees" declaration instruction can be used.
To convert degrees to radians, multiply degrees by
π
/180. To convert radians to
degrees, multiply radians by 180/
π
.
ACOS is the inverse trigonometric function of COSINE, which takes an angle
as its argument and returns the length ratio of the side adjacent to the angle to
the hypotenuse.
8-3