changeset 30537:9e56eb717561 stable

Faddeeva: Merge changes from upstream. * liboctave/external/Faddeva/Faddeva.cc: Merge changes from upstream http://ab-initio.mit.edu/wiki/index.php/Faddeeva_Package
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 23 Dec 2021 18:16:03 +0100
parents 9e47c6f6b548
children 91642eb6420e c94757297640
files liboctave/external/Faddeeva/Faddeeva.cc
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/external/Faddeeva/Faddeeva.cc	Mon Sep 27 10:38:27 2021 -0500
+++ b/liboctave/external/Faddeeva/Faddeeva.cc	Thu Dec 23 18:16:03 2021 +0100
@@ -140,6 +140,7 @@
                        functions near the origin.  Use gnulib functions
                        if GNULIB_NAMESPACE is defined.
      18 December 2012: Slight tweaks (remove recomputation of x*x in Dawson)
+          12 May 2015: Bugfix for systems lacking copysign function.
 */
 
 /////////////////////////////////////////////////////////////////////////
@@ -200,11 +201,23 @@
 // copysign was introduced in C++11 (and is also in POSIX and C99)
 #  if defined(_WIN32) || defined(__WIN32__)
 #    define copysign _copysign // of course MS had to be different
+#  elif defined(GNULIB_NAMESPACE) // we are using using gnulib <cmath>
+#    define copysign GNULIB_NAMESPACE::copysign
 #  elif (__cplusplus < 201103L) && !defined(HAVE_COPYSIGN) && !defined(__linux__) && !(defined(__APPLE__) && defined(__MACH__)) && !defined(_AIX)
-static inline double my_copysign(double x, double y) { return y<0 ? -x : x; }
+static inline double my_copysign(double x, double y) { return x<0 != y<0 ? -x : x; }
 #    define copysign my_copysign
 #  endif
 
+// If we are using the gnulib <cmath> (e.g. in the GNU Octave sources),
+// gnulib generates a link warning if we use ::floor instead of gnulib::floor.
+// This warning is completely innocuous because the only difference between
+// gnulib::floor and the system ::floor (and only on ancient OSF systems)
+// has to do with floor(-0), which doesn't occur in the usage below, but
+// the Octave developers prefer that we silence the warning.
+#  ifdef GNULIB_NAMESPACE
+#    define floor GNULIB_NAMESPACE::floor
+#  endif
+
 #else // !__cplusplus, i.e., pure C (requires C99 features)
 
 #  include "Faddeeva.h"