android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java |    
3 ++-
 android/source/src/java/org/mozilla/gecko/gfx/PointUtils.java            |    
4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 9844a197bfe91e7adb74e9e5859c7fbfaaf99e28
Author:     apurvapriyadarshi <apriyadarshi.1...@gmail.com>
AuthorDate: Wed Sep 20 15:22:19 2023 +0530
Commit:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
CommitDate: Thu Sep 21 07:15:22 2023 +0200

    tdf#147906 used StrictMath.hypot for Pythagorean addition
    
    Change-Id: I529dc199c2cc20ce91b7181f650c36db8d81fc9c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157098
    Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
    Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>

diff --git 
a/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java 
b/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
index c0da18ff70bd..b20d602a21cb 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
@@ -21,6 +21,7 @@ import org.mozilla.gecko.util.FloatUtils;
 
 import java.util.Timer;
 import java.util.TimerTask;
+import java.lang.StrictMath;
 
 /*
  * Handles the kinetic scrolling and zooming physics for a layer controller.
@@ -543,7 +544,7 @@ class JavaPanZoomController
     private float getVelocity() {
         float xvel = mX.getRealVelocity();
         float yvel = mY.getRealVelocity();
-        return (float) Math.sqrt(xvel * xvel + yvel * yvel);
+        return (float) StrictMath.hypot(xvel, yvel);
     }
 
     public PointF getVelocityVector() {
diff --git a/android/source/src/java/org/mozilla/gecko/gfx/PointUtils.java 
b/android/source/src/java/org/mozilla/gecko/gfx/PointUtils.java
index 4eb07a31f147..4eff380527d2 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/PointUtils.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/PointUtils.java
@@ -11,6 +11,8 @@ import android.graphics.PointF;
 import org.json.JSONException;
 import org.json.JSONObject;
 
+import java.lang.StrictMath;
+
 public final class PointUtils {
     public static PointF add(PointF one, PointF two) {
         return new PointF(one.x + two.x, one.y + two.y);
@@ -30,7 +32,7 @@ public final class PointUtils {
 
    /* Computes the magnitude of the given vector. */
    public static float distance(PointF point) {
-        return (float)Math.sqrt(point.x * point.x + point.y * point.y);
+        return (float)StrictMath.hypot(point.x, point.y);
    }
 
     /** Computes the scalar distance between two points. */

Reply via email to