Home | Downloads | Tactical Neuronics Updated MARCH 2025
Undocumented cMath Functions

cMath Functions


ABS

Returns a value of the same type that is passed to it specifying the absolute value of a number.

Syntax: Abs(number)

The absolute value of a number is its unsigned magnitude. For example, ABS(-1) and ABS(1) both return 1.


ATN

Returns the arctangent of a number.

Syntax: Atn(number)

Takes the ratio of two sides of a right triangle and returns the corresponding angle in radians. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.

The range of the result is -pi/2 to pi/2 radians.

To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.

Note: Atn is the inverse trigonometric function of Tan. Do not confuse Atn with the cotangent, which is the simple inverse of a tangent (1/tangent).


COS

Returns the cosine of an angle.

Syntax: Cos(number)

The number argument is any valid numeric expression that expresses an angle in radians. Returns the ratio of the side adjacent to the angle divided by the length of the hypotenuse. The result lies in the range -1 to 1.


EXP

Returns e (the base of natural logarithms) raised to a power.

Syntax: Exp(number)

If number exceeds 709.782712893, an error occurs. The constant e is approximately 2.718282.

Note: The Exp function complements the Log function and is sometimes referred to as the antilogarithm.


INT, FIX

Returns a value containing the integer portion of a number.

Syntax: Int(number) / Fix(number)

Both Int and Fix remove the fractional part of number and return the resulting integer value.

The difference: if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number.

Example: Int(-8.4) = -9, Fix(-8.4) = -8

Fix(number) is equivalent to: Sgn(number) * Int(Abs(number))


LOG

Returns the natural logarithm of a number.

Syntax: Log(number)

The number argument must be greater than zero. The natural logarithm is the logarithm to the base e (approximately 2.718282).

To calculate base-n logarithms: Logn(x) = Log(x) / Log(n)


RND

Returns a random number.

Syntax: Rnd[(number)]

If number is Rnd generates
Less than zero The same number every time, using number as the seed
Greater than zero The next random number in the sequence
Equal to zero The most recently generated number
Not supplied The next random number in the sequence

Returns a value less than 1 but greater than or equal to zero.

Before calling Rnd, use the Randomize statement without an argument to initialize the random-number generator with a seed based on the system timer.

To produce random integers in a given range:

Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

SGN

Returns an integer indicating the sign of a number.

Syntax: Sgn(number)

If number is Sgn returns
Greater than zero 1
Equal to zero 0
Less than zero -1

SIN

Returns the sine of an angle.

Syntax: Sin(number)

The number argument is any valid numeric expression that expresses an angle in radians. Returns the ratio of the side opposite the angle to the hypotenuse. The result lies in the range -1 to 1.


SQR

Returns the square root of a number.

Syntax: Sqr(number)

The number argument must be greater than or equal to zero.


TAN

Returns the tangent of an angle.

Syntax: Tan(number)

The number argument is any valid numeric expression that expresses an angle in radians. Returns the ratio of the sine to the cosine of an angle.


Logical Operators: AND, OR, NOT, XOR, EQV, IMP

AND — Performs a logical conjunction.

OR — Performs a logical disjunction.

NOT — Performs logical negation.

XOR — Performs a logical exclusion (exclusive or).

EQV — Performs a logical equivalence on two expressions.

IMP — Performs a logical implication on two expressions.

MOD — Divides one number by another and returns only the remainder.

Syntax: result = number1 Mod number2