math
acos(number num)
Performs math acos operation on num
.
Example
ds.math.acos(1)
0
asin(number num)
Performs math asin operation on num
.
Example
ds.math.asin(1)
1.5707963267948966
atan(number num)
Performs math atan operation on num
.
Example
ds.math.atan(1)
0.7853981633974483
avg(array arr)
Returns the average value of arr
.
Example
ds.math.avg([1,2,3])
2
clamp(number value, number minVal, number maxVal)
Limits value
to the range of minVal
and maxVal
.
Example
ds.math.clamp(100, 0, 10)
10
exp(number num)
Returns the result of e to the power of num
, in other words enum
.
Example
ds.math.exp(2)
7.38905609893065
exponent(number num)
Returns the non-decimal portion of a logarithmic operation.
exponent = (log(num
)/log(2)) + 1
Example
ds.math.exponent(2)
2
log(number num)
Performs math log operation. on num
.
Example
ds.math.log(2)
0.6931471805599453
mantissa(number num)
Returns the decimal portion of a logarithmic operation.
exponent = (log(num
)/log(2)) + 1
mantissa = num
* pow(2, -exponent)
Example
ds.math.mantissa(2)
0.5
mod(number num1, number num2)
Performs modulo operation, returns how many times num1
can go into num2
.
Example
ds.math.mod(2,4)
2
pow(number num1, number num2)
Returns the value of num1
to the power of num2
, in other words num1
num2
.
Example
ds.math.pow(2,2)
4
random
Returns a random float value between 0 and 1.
Example
ds.math.random
0.5963038027787421
randomInt(number num)
Returns a random integer between 0 and the provided number inclusive.
Example
ds.math.randomInt(500)
485
round(number num)
Rounds num
to the nearest whole number.
Example
ds.math.round(2.5)
3
sin(number num)
Performs math sin operation on num
.
Example
ds.math.sin(1)
0.8414709848078965
sqrt(number num)
Performs math square root operation on num
.
Example
ds.math.sqrt(4)
2