Deploy qHypot() to eliminate sqrt(sum of squares)


Applies to QDoubleMatrix4x4, QDoubleVector2D, QDoubleVector3D.

Summing squares and then taking the square root has some
{ov,und}erflow failures when the squares are logarithmically beyond
about half way to the bounds of the representable values of the type.
A hypot() implementation - such as qHypot(), which copes with
arbitrarily many parameters - takes care to avoid those failures,
thereby producing finite non-zero answers for a broader range of
vectors. Using hypot() also preserves precision better, for related
reasons, and handles infinities and NaN more coherently, should they
arise.

In the process, reverse some qFuzzyCompare() || qFuzzyIsNull() checks
so that the is-null check is done first, satisfying the precondition
of the comparison (neither argument should be zero) before it is
reached.

Task-number: QTBUG-142020
Pick-to: 6.11 6.10 6.8 6.5
Change-Id: I34eb88a5e518155ab7c4584ec07a20404a1c0eb5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
commit7e81c07241c3cd65e1f8890de24b99ba4d272e5c
parent9a4e60b591455d60b12ffffbc07be593d9c0e21a
authorEdward Welbourne <edward.welbourne@qt.io>
committerEdward Welbourne <edward.welbourne@qt.io>
commit timeFri, 12 Dec 2025 15:47:52 +0100