Finds the nearest power of two greater or equal to the given value.

Type signature

(x: number) => number

Examples

ceilToNearestPowerOfTwo(345);
// ⇒ 512
Try in REPL

Questions

  • How to get the nearest power of two greater or equal to the given value?

TypeScript sourceJavaScript source