]> git.r.bdr.sh - rbdr/dotfiles/blob
cd80994a72b7d59ad59f3cf1b760dc8002c5f8f5
[rbdr/dotfiles] /
1 'use strict';
2
3 var log = Math.log, LOG2E = Math.LOG2E;
4
5 module.exports = function (x) {
6 if (isNaN(x)) return NaN;
7 x = Number(x);
8 if (x < 0) return NaN;
9 if (x === 0) return -Infinity;
10 if (x === 1) return 0;
11 if (x === Infinity) return Infinity;
12
13 return log(x) * LOG2E;
14 };