Skip to content

math.MathUtils

Christian d'Heureuse edited this page Jun 6, 2026 · 1 revision

dsp-collection / math/MathUtils

math/MathUtils

Math utilities.

Type Aliases

Type Alias Description
UniFunction An univariate numeric function.

Functions

Function Description
floorLog2 Returns the same as Math.floor(Math.log2(i)) for values in the range 1 .. 2^31-1, but without possibly occurring arithmetic problems with floating point numbers.
fuzzyEquals -
getNextPowerOf2 Returns the lowest power of 2 that is higher than x.
hyperbolicDecline Calculates a hyperbolic decline factor.
isFuzzyInteger -
isPowerOf2 Returns true if x is a power of 2 between 1 and 2^30.
simpleMovingAverage Calculates the simple moving average (SMA) over an array of numbers.
triangularMovingAverage Calculates the triangular moving average (TMA) over an array of numbers.
triangularMovingAverageRef Reference implementation of the triangular moving average (TMA).

Clone this wiki locally