Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

es.math.sinh.js 669B

1234567891011121314151617181920212223
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var fails = require('../internals/fails');
  4. var expm1 = require('../internals/math-expm1');
  5. var abs = Math.abs;
  6. var exp = Math.exp;
  7. var E = Math.E;
  8. var FORCED = fails(function () {
  9. // eslint-disable-next-line es/no-math-sinh -- required for testing
  10. return Math.sinh(-2e-17) !== -2e-17;
  11. });
  12. // `Math.sinh` method
  13. // https://tc39.es/ecma262/#sec-math.sinh
  14. // V8 near Chromium 38 has a problem with very small numbers
  15. $({ target: 'Math', stat: true, forced: FORCED }, {
  16. sinh: function sinh(x) {
  17. var n = +x;
  18. return abs(n) < 1 ? (expm1(n) - expm1(-n)) / 2 : (exp(n - 1) - exp(-n - 1)) * (E / 2);
  19. }
  20. });