Useful math functions and range-based statistic computations.
If you need real statistics, consider using the Dstats library.
Convert from radians to degrees.
Convert from degrees to radians.
Linear interpolation, akin to GLSL's mix.
Clamp x in [min, max], akin to GLSL's clamp.
Integer truncation.
Integer flooring.
Safe asin: input clamped to [-1, 1]
Safe acos: input clamped to [-1, 1]
Same as GLSL step function.
0.0 is returned if x < edge, and 1.0 is returned otherwise.
Same as GLSL smoothstep function.
Integer log2
Computes next power of 2.
Computes next power of 2.
Computes sin(x)/x accurately.
Signed integer modulo a/b where the remainder is guaranteed to be in [0..b[,
even if a is negative. Only support positive dividers.
Find the root of a linear polynomial a + b x = 0
Finds the root roots of a quadratic polynomial a + b x + c x^2 = 0
T[] outRoots | array of root results, should have room for at least 2 elements. |
Finds the roots of a cubic polynomial a + b x + c x^2 + d x^3 = 0
T[] outRoots | array of root results, should have room for at least 2 elements. |
Returns the roots of a quartic polynomial a + b x + c x^2 + d x^3 + e x^4 = 0
Returns number of roots. roots slice should have room for up to 4 elements.
Arithmetic mean.
Minimum of a range.
Maximum of a range.
Variance of a range.
Standard deviation of a range.
SSE approximation of reciprocal square root.