Quirrel4.41.0

math

Arithmetic, trigonometry, rounding and hashing.

from "math" import ...

Values

FLT_MAXFLT_MAXThe largest finite value SQFloat can represent.
FLT_MINFLT_MINThe smallest positive value SQFloat can represent at full precision.
PIPIThe ratio of a circle's circumference to its diameter, for converting between radians and degrees and for angle math in general.
RAND_MAXRAND_MAXThe largest value rand() can return; rand() results span 0..RAND_MAX.

Functions

abspure fastcall abs(x: number): numberReturns the absolute value of x
acospure fastcall acos(x: number): floatReturns the arccosine of x
asinpure fastcall asin(x: number): floatReturns the arcsine of x
atanpure fastcall atan(x: number): floatReturns the arctangent of x
atan2pure fastcall atan2(y: number, x: number): floatReturns the arctangent of y/x using the signs to determine the quadrant
ceilpure fastcall ceil(x: number): floatRounds x upward to the nearest integer
clamppure fastcall clamp(x: number, min: number, max: number): numberClamps x to the range [min, max]
cospure fastcall cos(x: number): floatReturns the cosine of x (in radians)
deep_hashpure deep_hash(obj, [depth: int]): intReturns a hash value for the given object, hashing nested objects up to the specified depth (1..200)
exppure fastcall exp(x: number): floatReturns e raised to the power of x
fabspure fastcall fabs(x: number): floatReturns the absolute value of float(x)
floorpure fastcall floor(x: number): floatRounds x downward to the nearest integer
hashpure hash(obj): intReturns a hash value for the given object
logpure fastcall log(x: number): floatReturns the natural logarithm of x
log10pure fastcall log10(x: number): floatReturns the base-10 logarithm of x
maxpure fastcall max(x: number, y: number, ...: number): numberReturns the maximum value from the arguments
minpure fastcall min(x: number, y: number, ...: number): numberReturns the minimum value from the arguments
powpure fastcall pow(x: number, y: number): floatReturns x raised to the power y
randfastcall rand(): intReturns a random integer in range 0..RAND_MAX
roundpure fastcall round(x: number): floatRounds x to the nearest integer
sinpure fastcall sin(x: number): floatReturns the sine of x (in radians)
sqrtpure fastcall sqrt(x: number): floatReturns the square root of x
srandfastcall srand(seed: int)Sets the seed for rand()
tanpure fastcall tan(x: number): floatReturns the tangent of x (in radians)