lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] odd/brent 682f2ac 01/11: Relocate a function templat


From: Greg Chicares
Subject: [lmi-commits] [lmi] odd/brent 682f2ac 01/11: Relocate a function template
Date: Tue, 22 Jun 2021 16:54:04 -0400 (EDT)

branch: odd/brent
commit 682f2ac0a21cb0061ad1f37f69e2afa8b41ad48d
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Relocate a function template
    
    * zero2.hpp: Removed signum().
    * zero3.hpp: Removed signum().
    * zero.hpp: Moved signum() here, to define it OAOO.
    
    Brent didn't use signum(), but Scherer did. It appeared in two headers,
    so the unit test built but lmi didn't link. Moved it to a physically
    appropriate header (which doesn't use it) to avoid that problem.
---
 zero.hpp  | 6 ++++++
 zero2.hpp | 6 ------
 zero3.hpp | 8 --------
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/zero.hpp b/zero.hpp
index 30436c2..f7b8525 100644
--- a/zero.hpp
+++ b/zero.hpp
@@ -33,6 +33,12 @@
 #include <limits>
 #include <ostream>
 
+template<typename T>
+inline T signum(T t)
+{
+    return (0 == t) ? 0 : std::signbit(t) ? -1 : 1;
+}
+
 enum root_bias
     {bias_none   // Return root z with f(z) closest to 0.0 .
     ,bias_lower  // Require f(z) <= 0.0 .
diff --git a/zero2.hpp b/zero2.hpp
index c513e63..eb0171a 100644
--- a/zero2.hpp
+++ b/zero2.hpp
@@ -37,12 +37,6 @@
 #include <iostream>
 #include <limits>
 
-template<typename T>
-inline T signum(T t)
-{
-    return (0 == t) ? 0 : std::signbit(t) ? -1 : 1;
-}
-
 /// A C++ equivalent of Brent's algol60 original, for reference only.
 #if 0
 /// A C++ equivalent of Brent's algol60 original, for reference only.
diff --git a/zero3.hpp b/zero3.hpp
index 4ec6ce3..278ed3a 100644
--- a/zero3.hpp
+++ b/zero3.hpp
@@ -39,14 +39,6 @@
 #include <iostream>
 #include <limits>
 
-#if 0
-template<typename T>
-inline T signum(T t)
-{
-    return (0 == t) ? 0 : std::signbit(t) ? -1 : 1;
-}
-#endif // 0
-
 template<typename FunctionalType>
 double chand
     (double          a



reply via email to

[Prev in Thread] Current Thread [Next in Thread]