NextPowerOfTwo

NextPowerOfTwo(n)

Smallest power of two greater or equal to the given n.

NextPowerOfTwo(n) = 2^{\lceil \log_2(n)\rceil}

Parameters
npositive int
Returns
resultpositive int

Examples

>>> import openturns as ot
>>> int(ot.SpecFunc.NextPowerOfTwo(42))
64