proj4js/lib/common/hypot.js
2017-01-25 14:04:13 -05:00

9 lines
183 B
JavaScript

export default function(x, y) {
x = Math.abs(x);
y = Math.abs(y);
var a = Math.max(x, y);
var b = Math.min(x, y) / (a ? a : 1);
return a * Math.sqrt(1 + Math.pow(b, 2));
}