es.math.cosh.js 428 B

123456789101112131415
  1. var $ = require('../internals/export');
  2. var expm1 = require('../internals/math-expm1');
  3. var nativeCosh = Math.cosh;
  4. var abs = Math.abs;
  5. var E = Math.E;
  6. // `Math.cosh` method
  7. // https://tc39.github.io/ecma262/#sec-math.cosh
  8. $({ target: 'Math', stat: true, forced: !nativeCosh || nativeCosh(710) === Infinity }, {
  9. cosh: function cosh(x) {
  10. var t = expm1(abs(x) - 1) + 1;
  11. return (t + 1 / (t * E * E)) * (E / 2);
  12. }
  13. });