beautypg.com

Derived math functions – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 329

background image

Section 8. Processing and Math Instructions

XOR

The XOR function is used to perform a binary logical exclusion on two
numbers.

Syntax

result = number1 XOR number2

The XOR operator also performs a bit-wise comparison of identically
positioned bits in two numbers (may be variables or the results of expressions)
and sets the corresponding bit in result according to the following truth table:

If bit in
number1
is

And bit in
number2
is

The result is

0 0

0

0 1

1

1 0

1

1 1

0

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 CRBasic

equivalent

Secant

Sec = 1 / Cos(X)

Cosecant

Cosec = 1 / Sin(X)

Cotangent

Cotan = 1 / Tan(X)

Inverse Sine

Arcsin = Atn(X / Sqr(-X * X + 1))

Inverse Cosine

Arccos = Atn(-X / Sqr(-X * X + 1)) + 1.5708

Inverse Secant

Arcsec = Atn(X / Sqr(X * X - 1)) + Sgn(Sgn(X) -1) * 1.5708

Inverse Cosecant

Arccosec = Atn(X/Sqr(X * X - 1)) + (Sgn(X) - 1) * 1.5708

Inverse Cotangent

Arccotan = Atn(X) + 1.5708

Hyperbolic Secant

HSec = 2 / (Exp(X) + Exp(-X))

Hyperbolic Cosecant

HCosec = 2 / (Exp(X) - Exp(-X))

Hyperbolic Cotangent

HCotan = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))

Inverse Hyperbolic Sine

HArcsin = Log(X + Sqr(X * X + 1))

Inverse Hyperbolic Cosine

HArccos = Log(X + Sqr(X * X - 1))

Inverse Hyperbolic Tangent

HArctan = Log((1 + X) / (1 - X)) / 2

Inverse Hyperbolic Secant

HArcsec = Log((Sqr(-X * X + 1) + 1) / X)

Inverse Hyperbolic Cosecant

HArccosec = Log((Sgn(X) * Sqr(X * X + 1) +1) / X)

Inverse Hyperbolic Cotangent

HArccotan = Log((X + 1) / (X - 1)) / 2

Logarithm

LogN = Log(X) / Log(N)

8-43