Math & algorithms
algorithm
max
- Gives a reference to the maximum of the two elements.
min
- Gives a reference to the minimum of the two elements.
minmax
- Gives references to the minimum and maximum of the two elements.
swap -
Swaps two items in place.
sort -
Sorts an array. Uses insertion sort if the array is small enough, and
quickSort otherwise.
sortBy
- Sorts an array using less to order elements, so types
without an ordering (or orderings other than the natural one) can be
sorted.
math
abs -
Returns the absolute value.
clamp
- Constrains the value to the given range.
sin -
Returns the sine of x.
cos -
Returns the cosine of x.
tan -
Returns the tangent of x.
asin -
Returns the arc sine of x.
acos -
Returns the arc cosine of x.
atan -
Returns the arc tangent of x.
atan2
- Returns the arc tangent of y/x.
sinh -
Returns the hyperbolic sine of x.
cosh -
Returns the hyperbolic cosine of x.
tanh -
Returns the hyperbolic tangent of x.
exp -
Returns e raised to the power x.
exp2 -
Returns 2 raised to the power x.
log -
Returns the natural logarithm of x.
log2 -
Returns the base-2 logarithm of x.
log10
- Returns the base-10 logarithm of x.
pow -
Returns x raised to the power y.
sqrt -
Returns the square root of x.
cbrt -
Returns the cube root of x.
hypot
- Returns the square root of the sum of the squares of x and y.
ceil -
Rounds x up to an integer.
floor
- Rounds x down to an integer.
trunc
- Rounds x toward zero to an integer.
round
- Rounds x to the nearest integer.
fmod -
Returns the remainder of x/y.
pi -
Ratio of a circle's circumference to its diameter.
e -
Base of the natural logarithm.