3  Functions

The following built-in functions are available:

Math Functions
Function Description
ABS(Number) Absolute value of Number.
ACOS(Number) Returns the arccosine, or inverse cosine, of Number. The arccosine is the angle whose cosine is number. The returned angle is given in radians in the range 0 (zero) to PI.
ASIN(Number) Returns the arcsine, or inverse sine function, of Number, where -1 <= Number <= 1. The arcsine is the angle whose sine is Number. The returned angle is given in radians where -pi/2 <= angle <= pi/2.
ATAN(x) Returns the principal value of the arc tangent of x, expressed in radians..
ATAN2(y, x) Returns the principal value of the arc tangent of y,x, expressed in radians.
CEIL(Number) Smallest integer not less than Number.
CEIL(-3.2) = -3
CEIL(3.2) = 4
CLAMP(Number, Start, End) Constrains Number within the range of Start and End.
COMBIN(Number, NumberChosen) Returns the number of combinations for a given number (NumberChosen) of items from Number of items. Note that for combinations, order of items is not important.
COS(Number) Cosine of the angle Number in radians.
COSH(Number) Hyperbolic cosine of Number.
COT(Number) Cotangent of Number.
EXP(Number) Euler to the power of Number.
EVEN(Number) Returns Number rounded up to the nearest even integer.
Values are always rounded away from zero (e.g., EVEN(-3) = -4).
FAC(Number) Returns the factorial of Number. The factorial of Number is equal to 1*2*3*…* Number
FACT(Number) Alias for FAC()
FLOOR(Number) Returns the largest integer not greater than Number.
FLOOR(-3.2) = -4
FLOOR(3.2) = 3
ISEVEN(Number) Returns true if Number is even, false if odd.
ISODD(Number) Returns true if Number is odd, false if even.
LN(Number) Natural logarithm of Number (base Euler).
LOG10(Number) Common logarithm of Number (base 10).
MIN(Number1, Number2, …) Returns the smallest value from a specified range of values.
MAX(Number1, Number2, …) Returns the largest value from a specified range of values.
MAXINT() Returns the largest integer that the parser can process.
MOD(Number, Divisor) Returns the remainder after Number is divided by Divisor. The result has the same sign as divisor.
NAN Returns an invalid value (i.e., Not-a-number).
NCR(Number, NumberChosen) Alias for COMBIN().
NPR(Number, NumberChosen) Alias for PERMUT().
ODD(Number) Returns Number rounded up to the nearest odd integer.
Values are always rounded away from zero (e.g., ODD(-4) = -5).
PERMUT(Number, NumberChosen) Returns the number of permutations for a given number (NumberChosen) of items that can be selected Number of items. A permutation is any set of items where order is important. (This differs from combinations, where order is not important).
POW(Base, Exponent) Raises Base to any power. For fractional exponents, Base must be greater than 0.
POWER(Base, Exponent) Alias for POW().
RAND() Generates a random floating point number within the range of 0 and 1.
ROUND(Number, NumDigits) Number rounded to NumDigits decimal places.
If NumDigits is negative, then Number is rounded to the left of the decimal point.
(NumDigits is optional and defaults to zero.)
ROUND(-11.6, 0) = 12
ROUND(-11.6) = 12
ROUND(1.5, 0) = 2
ROUND(1.55, 1) = 1.6
ROUND(3.1415, 3) = 3.142
ROUND(-50.55, -2) = -100
SIGN(Number) Returns the sign of Number. Returns 1 if Number is positive, zero (0) if Number is 0, and -1 if Number is negative.
SIN(Number) Sine of the angle Number in radians.
SINH(Number) Hyperbolic sine of Number.
SQRT(Number) Square root of Number.
TAN(Number) Tangent of Number.
TGAMMA(Number) Returns the gamma function of Number.
TRUNC(Number) Discards the fractional part of Number.
TRUNC(-3.2) = -3
TRUNC(3.2) = 3
Engineering Functions
Function Description
BITAND(Number1, Number2) Returns a bitwise ‘AND’ of two (integral) numbers. (Both numbers must be positive and cannot exceed (2^48)-1.)
BITLROTATE8(Number, RotateAmount) Returns Number left rotated left to the most significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as an unsigned 8-bit integer.
(Only available if compiled as C++20.)
BITLROTATE16(Number, RotateAmount) Returns Number left rotated left to the most significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as an unsigned 16-bit integer.
(Only available if compiled as C++20.)
BITLROTATE32(Number, RotateAmount) Returns Number left rotated left to the most significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as an unsigned 32-bit integer.
(Only available if compiled as C++20.)
BITLROTATE64(Number, RotateAmount) Returns Number left rotated left to the most significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as an unsigned 64-bit integer.
(Only available if compiled as C++20.)
BITLROTATE(Number, RotateAmount) Returns Number left rotated left to the most significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as either a 32- or 64-bit integer (depending on what is supported by the compiler).
(Only available if compiled as C++20.)
BITLSHIFT(Number, ShiftAmount) Returns Number left shifted by the specified number (ShiftAmount) of bits.
Numbers cannot exceed (2^48)-1 and ShiftAmount cannot exceed 53 (or 63, if 64-bit is supported).
BITNOT8(Number) Returns a bitwise ‘NOT’ of a 8-bit integer.
BITNOT16(Number) Returns a bitwise ‘NOT’ of a 16-bit integer.
BITNOT32(Number) Returns a bitwise ‘NOT’ of a 32-bit integer.
BITNOT64(Number) Returns a bitwise ‘NOT’ of a 64-bit integer (if 64-bit integers are supported).
BITNOT(Number) Returns a bitwise ‘NOT’ of a 32- or 64-bit integer (depending on whether 64-bit is supported).
BITOR(Number1, Number2) Returns a bitwise ‘OR’ of two (integral) numbers. (Both numbers must be positive and cannot exceed (2^48)-1.)
BITRROTATE8(Number, RotateAmount) Returns Number right rotated right to the least significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as an unsigned 8-bit integer.
(Only available if compiled as C++20.)
BITRROTATE16(Number, RotateAmount) Returns Number right rotated right to the least significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as an unsigned 16-bit integer.
(Only available if compiled as C++20.)
BITRROTATE32(Number, RotateAmount) Returns Number right rotated right to the least significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as an unsigned 32-bit integer.
(Only available if compiled as C++20.)
BITRROTATE64(Number, RotateAmount) Returns Number right rotated right to the least significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as an unsigned 64-bit integer.
(Only available if compiled as C++20.)
BITRROTATE(Number, RotateAmount) Returns Number right rotated right to the least significant bit by the specified number (RotateAmount) of bits.
Numbers are rotated as either a 32- or 64-bit integer (depending on what is supported by the compiler).
(Only available if compiled as C++20.)
BITRSHIFT(Number, ShiftAmount) Returns Number right shifted by the specified number (ShiftAmount) of bits.
Numbers cannot exceed (2^48)-1 and ShiftAmount cannot exceed 53 (or 63, if 64-bit is supported).
BITXOR(Number1, Number2) Returns a bitwise ‘XOR’ of two (integral) numbers. (Both numbers must be positive and cannot exceed (2^48)-1.)
SUPPORTS32BIT() Returns true if 32-bit integers are supported. This will affect the supported range of values for bitwise operations.
SUPPORTS64BIT() Returns true if 64-bit integers are supported. This will affect the supported range of values for bitwise operations.

Defining TE_FLOAT will disable all bitwise functions and operators.

Statistical Functions
Function Description
AVGERAGE(Value1, Value2,…) Returns the mean of a specified range of values.
SUM(Value1, Value2,…) Returns the sum of a specified range of values.
Logic Functions
Function Description
AND(Value1, Value2, …) Returns true if all conditions are true.
IF(Condition, ValueIfTrue, ValueIfFalse) If Condition is true (non-zero), then ValueIfTrue is returned; otherwise, ValueIfFalse is returned.
Note that multiple IF commands can be nested to create a “case” statement.
IFS(Condition1, Value1, Condition2, Value2, …) Checks up to three conditions, returning the value corresponding to the first met condition.
This is shorthand for multiple nested IF commands, providing better readability. Will accept 1–3 condition/value pairs.
NaN will be returned if all conditions are false.
NOT(Value) Returns the logical negation of Value.
OR(Value1, Value2, …) Returns true if any condition is true.

The first argument to any logic function must be valid (i.e., not NaN). If the first argument evaluates to NaN, then NaN will be returned. Any subsequent arguments that evaluate to NaN will be ignored.

Compatibility Note

BITNOT will call either BITNOT32 or BITNOT64, depending on whether 64-bit integers are supported. This differs from Excel, which only works with 16-bit integers. To match the behavior of Excel, explicitly call BITNOT16.