MATHS MODULE - maths.pm
The module provides a set of macros which perform mathematical operations. When the macros are encoutered in an input file, they are evaluated and the result is returned in the output.

The maths module includes the following macros:

add(a, b, c, ...)
    Takes in any number of arguments and returns their sum: (a + b + c + ...)

sub(a, b)
    Returns a minus b: (a - b)

mul(a, b, c, ...)
    Takes in any number of arguments and returns their product: (a * b * c * ...)

div(a, b)
    Returns a over b: (a / b)

abs(a)
    Returns the absoulte value of a.

atan2(a, b)
    Returns the arctangent of a/b in the range -pi to pi.

cos(a)
    Returns the cosine of a in radians.

exp(a)
    Returns the e to the power of a.

int(a)
    Returns the integer portion of a.

log(a)
    Returns the natural logarithm (base e) of a.

rand(a)
    Returns a random fractional number between the range 0 and a. If a is omitted, returns a value between 0 and 1.

sin(a)
    Returns the sine of a in radians.

sqrt(a)
    Returns the square root of a.

srand(a)
    Sets the random number seed for rand().

The maths module also defines pi as M_PI as e as M_E.

The maths macros are implemented using the function.pm module. Nested macros are allowed, as is passing other macros with numerical defintions as arguments.