]> gerrit.simantics Code Review - simantics/district.git/blob - log2/shim.js
Hide "enabled" column for non-component type tech type tables
[simantics/district.git] / log2 / shim.js
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 };