es6.math.sinh.js 454 B

123456789101112131415
  1. // 20.2.2.30 Math.sinh(x)
  2. var $export = require('./_export');
  3. var expm1 = require('./_math-expm1');
  4. var exp = Math.exp;
  5. // V8 near Chromium 38 has a problem with very small numbers
  6. $export($export.S + $export.F * require('./_fails')(function () {
  7. return !Math.sinh(-2e-17) != -2e-17;
  8. }), 'Math', {
  9. sinh: function sinh(x) {
  10. return Math.abs(x = +x) < 1
  11. ? (expm1(x) - expm1(-x)) / 2
  12. : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
  13. }
  14. });