summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2017-03-06 17:36:46 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2017-03-21 13:23:11 +0000
commit22090b374f1f6e53a28188f91cca8b860c859555 (patch)
treebdd132c76215eb9dddf15fa151f1cb2590c86f9e /tests
parenta30343fe6aa4c15fcee4a14eabe45473a88056db (diff)
downloadqtlocation-22090b374f1f6e53a28188f91cca8b860c859555.tar.gz
Simplify a mathematical expression
Squaring a number, doubling it and taking the square root is just a roundabout way of multiplying the number by sqrt(2); so do that instead, saving some computational cost and probably reducing the amount of rounding errors that can creep in. Change-Id: I1abf3c2de318f48f80536379156ace8f25a6acaf Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative_ui/tst_map_item_fit_viewport.qml4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml
index fe4d9e49..92b0bb6e 100644
--- a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml
+++ b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml
@@ -572,13 +572,13 @@ Item {
}
function calculate_fit_circle_bounds() {
- var circleDiagonal = Math.sqrt(2 * fitCircle.radius * fitCircle.radius)
+ var circleDiagonal = Math.sqrt(2) * fitCircle.radius
fitCircleTopLeft = fitCircle.center.atDistanceAndAzimuth(circleDiagonal,-45)
fitCircleBottomRight = fitCircle.center.atDistanceAndAzimuth(circleDiagonal,135)
}
function calculate_bounds(){
- var circleDiagonal = Math.sqrt(2 * preMapCircle.radius * preMapCircle.radius)
+ var circleDiagonal = Math.sqrt(2) * preMapCircle.radius
var itemTopLeft = preMapCircle.center.atDistanceAndAzimuth(circleDiagonal,-45)
var itemBottomRight = preMapCircle.center.atDistanceAndAzimuth(circleDiagonal,135)