es.math.cbrt.js 309 B

12345678910111213
  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. return sign(x = +x) * pow(abs(x), 1 / 3);
  10. }
  11. });