You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2023/01/06 02:40:47 UTC

[commons-math] branch master updated: Simplify.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 423b72ff8 Simplify.
423b72ff8 is described below

commit 423b72ff8dffc54e4bd8e8036a24641026425f78
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Fri Jan 6 03:40:09 2023 +0100

    Simplify.
    
    Thanks to Alex Herbert.
---
 .../java/org/apache/commons/math4/legacy/core/MathArrays.java | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/MathArrays.java b/commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/MathArrays.java
index 869d10ad5..a208686de 100644
--- a/commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/MathArrays.java
+++ b/commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/MathArrays.java
@@ -581,13 +581,10 @@ public final class MathArrays {
      * @throws NotFiniteNumberException if any values of the array is not a
      * finite real number.
      */
-    public static void checkFinite(final double[] val)
-        throws NotFiniteNumberException {
-        for (int i = 0; i < val.length; i++) {
-            final double x = val[i];
-            if (Double.isInfinite(x) ||
-                Double.isNaN(x)) {
-                throw new NotFiniteNumberException(val[i]);
+    public static void checkFinite(final double[] val) {
+        for (double x : val) {
+            if (!Double.isFinite(x)) {
+                throw new NotFiniteNumberException(x);
             }
         }
     }