From 24ec3b3e7fa09900d791dcaedb0820a0b1890336 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 6 Mar 2017 17:25:45 +0100 Subject: Prefer qHypot() over sqrt(a sum of squares) It's apt to be more accurate and may even be optimised. Comment on a benchmark where we could use Math.hypot(), but that would break comparison with Qt 5 results. Change-Id: I7c37dd3df82fdef18e7ebb0e1548198afd256faa Reviewed-by: Ulf Hermann --- tests/manual/v4/v8-bench.js | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/manual/v4/v8-bench.js b/tests/manual/v4/v8-bench.js index bfce6231e4..33f39688c2 100644 --- a/tests/manual/v4/v8-bench.js +++ b/tests/manual/v4/v8-bench.js @@ -3645,6 +3645,7 @@ Flog.RayTracer.Vector.prototype = { }, magnitude : function() { + // return Math.hypot(this.x, this.y, this.z); but keep results Qt5-comparable: return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z)); }, -- cgit v1.2.3