a basic utiltiy pack to do math with floats and/or doubles
these functions all require the arguments {x:(number),y:(number)}
and ouput the result to the storage gm:io out
as well as returning the result as an int
does
x + y
does
x - y
does
x * y
when specifying x
as a number
does
x / y
when specifying x
as an array of numbers (will only divide up to the first 3 numbers in the array)
does
[0] / y, [1] / y, [2] / y
outputs the resulting numbers in an array in the default output location and returns the length of the outputted array
does
x % y
implementation of fmod. fails if y is 0
gets the distance between
x
andy
for this operation 2 position arrays must be given instead of single values. If an array is empty or values are unspecified, the values will default to 0
does
atan2(y, x)
this operation is similar to doing tan⁻¹(y/x)
, except that -180 ≤ atan2(y, x) ≤ 180
. This gives a full 360° result, compared the 180° result of just doing tan⁻¹(y/x)
these functions only requires {x:(number)}
as an argument
does
x * -1
does
1 / x
does
x^2
does
√x
does
sin(x)
does
cos(x)
does
tan(x)
also outputs sin to storage gm._temp_:std var1
and cos to storage gm._temp_:std var2
does
sin⁻¹(x)
-90 ≤ sin⁻¹(x) ≤ 90
where -1 ≤ x ≤ 1
does
cos⁻¹(x)
0 ≤ cos⁻¹(x) ≤ 180
where -1 ≤ x ≤ 1
does
tan⁻¹(x)
-90 ≤ tan⁻¹(x) ≤ 90
does
round(x)
Rounds x to the nearest integer. 0.5
will round up
does
floor(x)
Rounds x down to the nearest integer
does
ceil(x)
Rounds x up to the nearest integer