Specifications
Section 8. Processing and Math Instructions
8-30
If X = 0, then Sgn(X) = 0.
If X < 0, then Sgn(X) = -1.
SGN Function Example
The example uses SGN to determine the sign of a number.
Dim Msg, Number, Volt 'Declare variables.
BeginProg
Number = Volt(1) 'Get user input.
Select Case Sgn(Number) 'Evaluate Number.
Case 0 'Zero.
Msg = 0
Case 1 'Positive.
Msg = 1
Case -1 'Negative.
Msg = -1
EndSelect
EndProg
SIN (Angle)
Returns the sine of an angle.
Syntax
x = SIN (Angle)
Remarks
The Angle argument can be any valid numeric expression measured in radians.
The SIN function takes an angle and returns the ratio of two sides of a right
triangle. The ratio is the length of the side opposite the angle divided by the
length of the hypotenuse.
The result lies in the range -1 to 1.
To convert degrees to radians, multiply degrees by π/180. To convert radians
to degrees, multiply radians by 180/π.
Returns the sine of the value in parentheses. The input must be in radians.
SIN Function Example
The example uses SIN to calculate the sine of an angle from a Volt input.
Dim Degrees, Pi, Radians, Ans 'Declare variables.
Pi = 4 * ATN(1) 'Calculate Pi.
Degrees = Volt(1) 'Get input.
Radians = Degrees * (Pi / 180) 'Convert to radians.
Ans = SIN(Radians) ‘The Sine of Degrees.