Math Functions

Director supports the usual complement of math functions, as shown in Table 8-2. Refer to Table 8-3 and Table 8-4 for exponentiation and trigonometric functions.

Table 8-2. Math Functions

Lingo Keyword

Usage and Range

[a]
[b]
[c]

abs()

Calculates the absolute value of a number. Returns float or integer. Used to calculate unsigned values, such as distances.

add()

The add command pertains only to lists and is not a mathematical function. See the “+” operator.

charToNum()[a]

Converts ASCII character to ASCII code. See numToChar().

FALSE

Constant equivalent to zero (0). See TRUE.

float()

Converts string or integer to floating-point value. See the floatPrecision.

floatP()

Returns TRUE if operand is a floating-point value.

the floatPrecision[b]

Determines the number of decimal places used to display floats (default is 4). Does not affect calculation accuracy.

INF or -INF[b]

Indicates an overflow condition caused by a number larger than maximum allowed float or an undefined value.

integer()

Rounds floats to the nearest integer. integer(-.5) is rounded to −1, not zero. Use value() to convert strings first.

integerP()

Returns TRUE if operand is an integer.

max()

Returns maximum number from a list or comma-delimited series. Also works with strings.

the maxInteger[b]

Returns the maximum supported integer (2147483647), which equals 231−1.

min()

Returns minimum number from a list or comma-delimited series. Also works with strings.

mod

Modulo division ...

Get Lingo in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.