Mathematical functions

abs($expr)

The absolute value.

rand()

Returns a random number in the range from 0 (inclusive) to 1 (exclusive), [0,1). Returns a new value for each call. Also useful for selecting a subset or random ordering.

round($expr)

Round to the nearest integer; ceil() and floor() find the next integer up or down.

sqrt($expr)

The square root.

sign($expr)

0 if zero, -1 if negative, 1 if positive.

sin($expr)

Trigonometric functions also include cos(), tan(), cot(), asin(), acos(), atan(), atan2(), and haversin(). All arguments for the trigonometric functions should be in radians, if not otherwise specified.

degrees($expr), radians($expr), pi()

Converts radians into degrees; use radians() for the reverse, and pi() for π.

log10($expr), log($expr), exp($expr), e()

Logarithm base 10, natural logarithm, e to the power of the parameter, and the value of e.

Comments