nextpow2.RdSmallest power of 2 greater than the argument.
nextpow2(x)Computes the smalest integer n such that \(abs(x) \le 2^n\).
IF x is a vector or matrix, returns the result component-wise.
For negative or complex values, the absolute value will be taken.
an integer n such that \(x \le 2^n\).
nextpow2(10) #=> 4
#> [1] 4
nextpow2(1:10) #=> 0 1 2 2 3 3 3 3 4 4
#> [1] 0 1 2 2 3 3 3 3 4 4
nextpow2(-2^10) #=> 10
#> [1] 10
nextpow2(.Machine$double.eps) #=> -52
#> [1] -52