Link Search Menu Expand Document

Math

Functions


^

x^y

Exponentiation. Use as any other arithmetic operator, like 5^(1/3). If exponent is an integer, you can use a negative base, otherwise you will get “NaN” with a negative base. If both arguments are integers, the result will be an integer.


abs

int/float abs(int/float x)

Absolute (positive) value of x.


arctan

float arctan(float x, float y)

Arctangent of x. Pass 1 as y (don’t ask…).


ceil

int ceil(float)

Round x to the nearest integer that is not less than x.


cos

float cos(float x)

Cosine of x


div

div(x, y)

Unsigned integer division. Use as a division operator, like 3 + (20 div 5). If both dividend and divisor are integers, they will be treated as unsigned integers. If one of them is a float, div will perform the signed division just like vanilla division operator.


exponent

float exponent(float x)

E^X


floor2

sfall.h

int floor2(int/float value)

Works just like vanilla floor function, but returns correct integers for negative values (vanilla floor function works exactly the same as ceil for negative values, much like trunc in C/C++).


log

float log(float x)

Natural logarithm of x.


round

int round(float x)

Round x to the nearest integer.


sin

float sin(float x)

Sine of x


sqrt

float sqrt(float x)

Square root of x.


tan

float tan(float x)

Tangent of x