Next Power of Two

Find the next power of two greater than or equal to a given number.

Code

General
echo "scale=0; if ($n <= 1) 1 else 2^(l($n)/l(2) + 0.9999999)/1" | bc -l

Parameters

Number

Server

More Bash Snippets