Skip to content

math.MathUtils.Function.floorLog2

Christian d'Heureuse edited this page Jun 7, 2026 · 2 revisions

dsp-collection / math/MathUtils / floorLog2

Function: floorLog2()

function floorLog2(x): number;

Defined in: math/MathUtils.ts:49

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.

Parameters

x

number

Returns

number

Clone this wiki locally