PageRenderTime 14ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/node_modules/babel-polyfill/node_modules/core-js/library/modules/es6.math.hypot.js

https://bitbucket.org/worklabschd/bingle_customer2
JavaScript | 25 lines | 23 code | 1 blank | 1 comment | 5 complexity | b9ab3ce64cf06689be44735a9e226f02 MD5 | raw file
 1// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
 2var $export = require('./_export');
 3var abs = Math.abs;
 4
 5$export($export.S, 'Math', {
 6  hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars
 7    var sum = 0;
 8    var i = 0;
 9    var aLen = arguments.length;
10    var larg = 0;
11    var arg, div;
12    while (i < aLen) {
13      arg = abs(arguments[i++]);
14      if (larg < arg) {
15        div = larg / arg;
16        sum = sum * div * div + 1;
17        larg = arg;
18      } else if (arg > 0) {
19        div = arg / larg;
20        sum += div * div;
21      } else sum += arg;
22    }
23    return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
24  }
25});