[geos-commits] [SCM] GEOS branch master updated. c5b75f576a60cad8c7ae9fc48e90b22a783cad4c

git at osgeo.org git at osgeo.org
Wed Feb 12 18:17:48 PST 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  c5b75f576a60cad8c7ae9fc48e90b22a783cad4c (commit)
      from  da0cb7bf9f7d3ce50edace9fa370b22c48e0e685 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c5b75f576a60cad8c7ae9fc48e90b22a783cad4c
Author: Even Rouault <even.rouault at spatialys.com>
Date:   Thu Feb 13 00:45:53 2020 +0100

    Use !std::isfinite() to exclude nan and infinite values
    
    - std::isnan() is useless when !std::isfinite() is tested
    - std::isnan() || std::isinf() can be replaced by !std::isfinite()

diff --git a/src/algorithm/CGAlgorithmsDD.cpp b/src/algorithm/CGAlgorithmsDD.cpp
index c25c1f2..1ec67c8 100644
--- a/src/algorithm/CGAlgorithmsDD.cpp
+++ b/src/algorithm/CGAlgorithmsDD.cpp
@@ -63,7 +63,7 @@ CGAlgorithmsDD::orientationIndex(const Coordinate& p1,
                                  const Coordinate& p2,
                                  const Coordinate& q)
 {
-    if(std::isnan(q.x) || std::isnan(q.y) || !std::isfinite(q.x) || !std::isfinite(q.y)) {
+    if(!std::isfinite(q.x) || !std::isfinite(q.y)) {
         throw util::IllegalArgumentException("CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers");
     }
 
@@ -99,8 +99,7 @@ CGAlgorithmsDD::signOfDet2x2(const DD& x1, const DD& y1, const DD& x2, const DD&
 int
 CGAlgorithmsDD::signOfDet2x2(double dx1, double dy1, double dx2, double dy2)
 {
-    if(std::isnan(dx1)    ||  std::isnan(dy1)    ||  std::isnan(dx2)    ||  std::isnan(dy2) ||
-            !std::isfinite(dx1) || !std::isfinite(dy1) || !std::isfinite(dx2) || !std::isfinite(dy2)) {
+    if(!std::isfinite(dx1) || !std::isfinite(dy1) || !std::isfinite(dx2) || !std::isfinite(dy2)) {
         throw util::IllegalArgumentException("CGAlgorithmsDD::signOfDet2x2 encountered NaN/Inf numbers");
     }
     DD x1(dx1);
@@ -178,8 +177,7 @@ CGAlgorithmsDD::intersection(const Coordinate& p1, const Coordinate& p2,
 
     Coordinate rv;
 
-    if (std::isnan(xInt) || std::isnan(yInt) ||
-        std::isinf(xInt) || std::isinf(yInt)) {
+    if (!std::isfinite(xInt) || !std::isfinite(yInt)) {
         rv.setNull();
         return rv;
     }
diff --git a/src/algorithm/Intersection.cpp b/src/algorithm/Intersection.cpp
index 834b7c0..455bd60 100644
--- a/src/algorithm/Intersection.cpp
+++ b/src/algorithm/Intersection.cpp
@@ -71,8 +71,7 @@ Intersection::intersection(const geom::Coordinate& p1, const geom::Coordinate& p
     double yInt = y/w;
     geom::Coordinate rv;
     // check for parallel lines
-    if (std::isnan(xInt) || std::isnan(yInt) ||
-        std::isinf(xInt) || std::isinf(yInt)) {
+    if (!std::isfinite(xInt) || !std::isfinite(yInt)) {
         rv.setNull();
         return rv;
     }

-----------------------------------------------------------------------

Summary of changes:
 src/algorithm/CGAlgorithmsDD.cpp | 8 +++-----
 src/algorithm/Intersection.cpp   | 3 +--
 2 files changed, 4 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list