CML Reference Guide

Chapter 4.6:  Mathematics

[TOP] [UP] [PREV] [NEXT]

$plus(a b)
Evaluates to the sum of numbers a and b.

$plusmod(a b x)
Evaluates to sum of a and b, modulo x.

$minus(a b)
Evaluates to the difference, a - b.

$mult(a b)
Evaluates to the product of a and b.

$divide(a b)
Evaluates to the integer quotient of a / b.

$greater(a b)
Evaluates to "1" if a is greater than b.  Otherwise "0".

$gt_equal(a b)
Evaluates to "1" if a is greater than or equal to b.  Otherwise "0".

$less(a b)
Evaluates to "1" if a is less than b.  Otherwise "0".

$between(a x b)
Evaluates to "1" if x is between a and b (a <= x <= b).  Otherwise "0".  Very useful for processing the result of server-side image maps.

$max(a b)
Evalutes to the larger of numbers a and b.

$min(a b)
Evaluates to the smaller of numbers a and b.

$bit_and(a b ...)
Evaluates to bitwise logical AND of a, b, etc.

$bit_or(a b ...)
Evaluates to bitwise logical OR of a, b, etc.

$bit_not(a)
Evaluates to the first 16 bits of the bitwise logical negation of a.

$hex2dec(a)
Evaluates to the (decimal) number with hexadecimal value a.  E.g., $hex2dec(f) is 15.

$dec2hex(a)
Evaluates to the (hexadecimal) number with decimal value a.  E.g., $dec2hex(15) is "f".

$random(max)
Evaluates to a random number from 0 to max-1, inclusive.