es6.math.acosh.js 484 B

1234567891011121314
  1. // 20.2.2.3 Math.acosh(x)
  2. var $export = require('./$.export')
  3. , log1p = require('./$.math-log1p')
  4. , sqrt = Math.sqrt
  5. , $acosh = Math.acosh;
  6. // V8 bug https://code.google.com/p/v8/issues/detail?id=3509
  7. $export($export.S + $export.F * !($acosh && Math.floor($acosh(Number.MAX_VALUE)) == 710), 'Math', {
  8. acosh: function acosh(x){
  9. return (x = +x) < 1 ? NaN : x > 94906265.62425156
  10. ? Math.log(x) + Math.LN2
  11. : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
  12. }
  13. });