UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

17 lines (16 loc) 529 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.log2 = log2; function log2(x) { // discuss at: https://locutus.io/python/log2/ // parity verified: Python 3.12 // original by: Kevin van Zonneveld (https://kvz.io) // note 1: Returns the base-2 logarithm of x // example 1: log2(1) // returns 1: 0 // example 2: log2(2) // returns 2: 1 // example 3: log2(8) // returns 3: 3 return Math.log2(x); }