This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit a51cb3f80bf240b49f45534ade80f0dc56c651ca
Author: Alex Herbert <[email protected]>
AuthorDate: Wed Sep 24 18:09:18 2025 +0100

    pmd fix: use final
---
 .../org/apache/commons/numbers/core/ArithmeticUtils.java     |  4 ++--
 .../src/main/java/org/apache/commons/numbers/core/DD.java    | 12 ++++++------
 .../main/java/org/apache/commons/numbers/core/DDMath.java    |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git 
a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/ArithmeticUtils.java
 
b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/ArithmeticUtils.java
index 6e2c886e..cf605761 100644
--- 
a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/ArithmeticUtils.java
+++ 
b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/ArithmeticUtils.java
@@ -70,7 +70,7 @@ public final class ArithmeticUtils {
         int a = p > 0 ? -p : p;
         int b = q > 0 ? -q : q;
 
-        int negatedGcd;
+        final int negatedGcd;
         if (a == 0) {
             negatedGcd = b;
         } else if (b == 0) {
@@ -144,7 +144,7 @@ public final class ArithmeticUtils {
         long a = p > 0 ? -p : p;
         long b = q > 0 ? -q : q;
 
-        long negatedGcd;
+        final long negatedGcd;
         if (a == 0) {
             negatedGcd = b;
         } else if (b == 0) {
diff --git 
a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DD.java 
b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DD.java
index 89b17e94..324e3f99 100644
--- a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DD.java
+++ b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DD.java
@@ -685,8 +685,8 @@ public final class DD
         if (a == x) {
             // Edge case: Any double value above 2^53 is even. To workaround 
representation
             // of 2^63 as Long.MAX_VALUE (which is 2^63-1) we can split a into 
two parts.
-            long a1;
-            long a2;
+            final long a1;
+            final long a2;
             if (Math.abs(x) > TWO_POW_53) {
                 a1 = (long) (x * 0.5);
                 a2 = a1;
@@ -1697,8 +1697,8 @@ public final class DD
         // Break this down into e.g.: 2^512^(exp / 512) * 2^(exp % 512)
         // Number of multiples n = exp / 512   : exp >>> 9
         // Remainder           m = exp % 512   : exp & 511  (exp must be 
positive)
-        int n;
-        int m;
+        final int n;
+        final int m;
         double p;
         if (exp < 0) {
             // Downscaling
@@ -1719,8 +1719,8 @@ public final class DD
         // Down-scaling to sub-normal will use the final multiplication into a 
sub-normal result.
         // Note here that n >= 1 as the n in [-1022, 1023] case has been 
handled.
 
-        double z0;
-        double z1;
+        final double z0;
+        final double z1;
 
         // Handle n : 1, 2, 3, 4, 5
         if (n >= 5) {
diff --git 
a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DDMath.java
 
b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DDMath.java
index 4909d274..f118e9aa 100644
--- 
a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DDMath.java
+++ 
b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DDMath.java
@@ -434,7 +434,7 @@ public final class DDMath {
     private static double add3(double a0, double a1, double a2, double b, MDD 
s12) {
         // Hide et al (2008) Fig.5: Quad-Double + Double without final a3.
         double u;
-        double v;
+        final double v;
         final double s0 = a0 + b;
         u = DD.twoSumLow(a0, b, s0);
         final double s1 = a1 + u;

Reply via email to