summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/shim.js
blob: 531e2891fe2f6750ad7eb18b62fad4aedc0e4503 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict';

var log = Math.log;

module.exports = function (x) {
	if (isNaN(x)) return NaN;
	x = Number(x);
	if (x < -1) return NaN;
	if (x > 1) return NaN;
	if (x === -1) return -Infinity;
	if (x === 1) return Infinity;
	if (x === 0) return x;
	return 0.5 * log((1 + x) / (1 - x));
};