es-shims / Math.log2

An ES-spec-compliant Math.log2 shim/polyfill/replacement that works as far down as ES3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Math.log2 Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ESnext spec-compliant Math.log2 shim/polyfill/replacement that works as far down as ES3.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Getting started

npm install --save math.log2

Usage/Examples

console.log(Math.log2(3)); // 1.584962500721156
console.log(Math.log2(2)); // 1
console.log(Math.log2(1)); // 0
console.log(Math.log2(0)); // -Infinity
console.log(Math.log2(-2)); // NaN
console.log(Math.log2(1024)); // 10

Tests

Simply clone the repo, npm install, and run npm test

About

An ES-spec-compliant Math.log2 shim/polyfill/replacement that works as far down as ES3

License:MIT License


Languages

Language:JavaScript 100.0%