This is an old version, view current version.

2.2 Absolute functions

T abs(T x)
The absolute value of x.

This function works elementwise over containers such as vectors. Given a type T which is int, or an array of ints, abs returns the same type where each element has had its absolute value taken.
Available since 2.0, vectorized in 2.30

int int_step(int x)

int int_step(real x)
Return the step function of x as an integer, \[ \mathrm{int\_step}(x) = \begin{cases} 1 & \text{if } x > 0 \\ 0 & \text{if } x \leq 0 \text{ or } x \text{ is } NaN \end{cases} \] Warning: int_step(0) and int_step(NaN) return 0 whereas step(0) and step(NaN) return 1.

See the warning in section step functions about the dangers of step functions applied to anything other than data.
Available since 2.0