Arithmetic mean.
Clamp x in [min, max], akin to GLSL's clamp.
Convert from radians to degrees.
Integer log2 TODO: use bt intrinsics
Linear interpolation, akin to GLSL's mix.
Integer flooring.
Integer truncation.
Maximum of a range.
Minimum of a range.
Signed integer modulo a/b where the remainder is guaranteed to be in [0..b[, even if a is negative. Only support positive dividers.
Computes next power of 2.
Computes next power of 2.
Convert from degrees to radians.
Safe acos: input clamped to [-1, 1]
Safe asin: input clamped to [-1, 1]
Computes sin(x)/x accurately.
Same as GLSL smoothstep function. See: http://en.wikipedia.org/wiki/Smoothstep
Finds the roots of a cubic polynomial a + b x + c x^2 + d x^3 = 0
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
Returns the roots of a quartic polynomial a + b x + c x^2 + d x^3 + e x^4 = 0
Standard deviation of a range.
Same as GLSL step function. 0.0 is returned if x < edge, and 1.0 is returned otherwise.
Variance of a range.
Useful math functions and range-based statistic computations.
If you need real statistics, consider using the Dstats library.