es.math.cbrt.js 320 B

1234567891011121314
  1. var $ = require('../internals/export');
  2. var sign = require('../internals/math-sign');
  3. var abs = Math.abs;
  4. var pow = Math.pow;
  5. // `Math.cbrt` method
  6. // https://tc39.es/ecma262/#sec-math.cbrt
  7. $({ target: 'Math', stat: true }, {
  8. cbrt: function cbrt(x) {
  9. var n = +x;
  10. return sign(n) * pow(abs(n), 1 / 3);
  11. }
  12. });