mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
12 lines
206 B
JavaScript
12 lines
206 B
JavaScript
'use strict';
|
|
|
|
var exp = Math.exp;
|
|
|
|
module.exports = function (x) {
|
|
if (isNaN(x)) return NaN;
|
|
x = Number(x);
|
|
if (x === 0) return 1;
|
|
if (!isFinite(x)) return Infinity;
|
|
return (exp(x) + exp(-x)) / 2;
|
|
};
|