Mirror Engine
V5
How To
Mirror Engine Logo

Mirror Engine API


Mirror Engine API / math / nearestPowerOfTwo

Function: nearestPowerOfTwo()

function nearestPowerOfTwo(val: number): number

Returns the nearest (smaller or larger) power of 2 for the specified value.

Parameters

val

number

The value for which to calculate the nearest power of 2.

Returns

number

The nearest power of 2.

Mirror Engine Logo