[geos-commits] [SCM] GEOS branch main updated. 26292ce88077321ced5db5869ea0b11cabaa2d12

git at osgeo.org git at osgeo.org
Wed Jan 15 15:30:43 PST 2025


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, main has been updated
       via  26292ce88077321ced5db5869ea0b11cabaa2d12 (commit)
      from  f74855c5a6ae36dcf31c1fd43ffca60350fbaf3c (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 26292ce88077321ced5db5869ea0b11cabaa2d12
Author: Mike Taves <mwtoews at gmail.com>
Date:   Thu Jan 16 12:30:12 2025 +1300

    geosop: show most floating-point exceptions in verbose mode (#1228)

diff --git a/util/geosop/GeosOp.cpp b/util/geosop/GeosOp.cpp
index 43a453b3a..17ace47fd 100644
--- a/util/geosop/GeosOp.cpp
+++ b/util/geosop/GeosOp.cpp
@@ -26,6 +26,7 @@
 #include <geos/io/WKBStreamReader.h>
 #include <geos/io/WKBWriter.h>
 
+#include <cfenv>
 #include <fstream>
 #include <iostream>
 #include <sstream>
@@ -393,7 +394,26 @@ void GeosOp::run(OpArguments& opArgs) {
     //------------------------
 
     try {
+        std::feclearexcept(FE_ALL_EXCEPT); // clear floating-point status flags
+
         execute(op, opArgs);
+
+        // Catch everything except for FE_INEXACT, which is usually harmless
+        const int fpexp = std::fetestexcept(FE_ALL_EXCEPT ^ FE_INEXACT);
+        if (args.isVerbose && (fpexp != 0)) {
+            std::cerr << "Operation raised floating-point environment flag(s):";
+            if (fpexp & FE_DIVBYZERO)
+                std::cerr << " FE_DIVBYZERO";
+            if (fpexp & FE_INEXACT)
+                std::cerr << " FE_INEXACT";
+            if (fpexp & FE_INVALID)
+                std::cerr << " FE_INVALID";
+            if (fpexp & FE_OVERFLOW)
+                std::cerr << " FE_OVERFLOW";
+            if (fpexp & FE_UNDERFLOW)
+                std::cerr << " FE_UNDERFLOW";
+            std::cerr << std::endl;
+        }
     }
     catch (std::exception &e) {
         std::cerr << "Run-time exception: " << e.what() << std::endl;

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

Summary of changes:
 util/geosop/GeosOp.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list