5.4.2 Function calls

Function calls have the following syntax:

 
name(arglist)

where name stands for the function name and arglist denotes the argument list: a comma-separated list of expressions which are evaluated and supply actual arguments for the function.

The following functions are supported by SLB version 1.0:

function: d (x)

Returns the derivative of x, i.e. the speed of its change per second, measured between the two last wakeups of slb (see section wakeup).

Notice, that this function is available only in standalone mode (see section standalone mode).

function: max (x0, ..., xn)

Returns the maximum value of its arguments. Any number of arguments can be given.

function: min (x0, ..., xn)

Returns the minimum value of its arguments.

function: avg (x0, ..., xn)

Returns the average value of its arguments.

function: log (x)

Returns the natural logarithm of x.

function: log10 (x)

Returns the decimal logarithm of x.

function: exp (x)

Returns the value of e (the base of natural logarithms) raised to the power of x.

function: pow (x, y)

Returns the value of x raised to the power of y. This function is provided for the sake of completeness, as it is entirely equivalent to ‘x ** y’.

function: sqrt (x)

Returns the non-negative square root of x.

function: abs (x)

Returns the absolute value of x.

function: ceil (x)

Returns the smallest integral value that is not less than x.

 
ceil(0.5) ⇒ 1.0
ceil(-0.5) ⇒ 0
function: floor (x)

Returns the largest integral value that is not greater than x.

 
floor(0.5) ⇒ 0.0
floor(-0.5) ⇒ -1.0
function: trunc (x)

Rounds x to the nearest integer not larger in absolute value.

function: round (x)

Rounds x to the nearest integer, but round halfway cases away from zero:

 
round(0.5) ⇒ 1.0
round(-0.5) ⇒ -1.0