Download Campbell DSP4 Specifications
Transcript
Section 8. Processing and Math Instructions XOR Operator Example The example sets the variable Msg based on the value of variables A, B, and C, assuming that no variable is a Null. If A = 10, B = 8, and C = 11, the left expression is True and the right expression is False. Because only one comparison expression is True, the XOR expression evaluates True. Dim A, B, C A = 10: B = 8: C = 11 If A > B XOR B > C Then Msg = True Else Msg = False. End If 'Declare variables. 'Assign values. 'Evaluate expressions. Derived Math Functions The following is a list of nonintrinsic mathematical functions that can be derived from the intrinsic math functions provided with CRBasic: Function Secant Cosecant Cotangent Inverse Secant Inverse Cosecant Inverse Cotangent Hyperbolic Secant Hyperbolic Cosecant Hyperbolic Cotangent Inverse Hyperbolic Sine Inverse Hyperbolic Cosine Inverse Hyperbolic Tangent Inverse Hyperbolic Secant Inverse Hyperbolic Cosecant Inverse Hyperbolic Cotangent Logarithm CRBasic equivalent Sec = 1 / Cos(X) Cosec = 1 / Sin(X) Cotan = 1 / Tan(X) Arcsec = Atn(X / Sqr(X * X - 1)) + Sgn(Sgn(X) -1) *1.5708 Arccosec = Atn(X/Sqr(X * X - 1)) + (Sgn(X) - 1) * 1.5708 Arccotan = Atn(X) + 1.5708 HSec = 2 / (Exp(X) + Exp(-X)) HCosec = 2 / (Exp(X) - Exp(-X)) HCotan = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X)) HArcsin = Log(X + Sqr(X * X + 1)) HArccos = Log(X + Sqr(X * X - 1)) HArctan = Log((1 + X) / (1 - X)) / 2 HArcsec = Log((Sqr(-X * X + 1) + 1) / X) HArccosec = Log((Sgn(X) * Sqr(X * X + 1) +1) / X) HArccotan = Log((X + 1) / (X - 1)) / 2 LogN = Log(X) / Log(N) 8-39