Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-10-09 07:15:12


Author: johnmaddock
Date: 2007-10-09 07:15:11 EDT (Tue, 09 Oct 2007)
New Revision: 39834
URL: http://svn.boost.org/trac/boost/changeset/39834

Log:
Fix problem with GCC on Linux not finding std_real_concept overload for fmod.
Added:
   trunk/boost/math/tools/workaround.hpp (contents, props changed)
Text files modified:
   trunk/boost/math/concepts/real_concept.hpp | 2 +-
   trunk/boost/math/concepts/std_real_concept.hpp | 2 +-
   trunk/boost/math/special_functions/ellint_1.hpp | 1 +
   trunk/boost/math/special_functions/ellint_2.hpp | 1 +
   trunk/boost/math/special_functions/ellint_3.hpp | 1 +
   trunk/boost/math/special_functions/spherical_harmonic.hpp | 1 +
   trunk/boost/math/tools/config.hpp | 23 +++++------------------
   7 files changed, 11 insertions(+), 20 deletions(-)

Modified: trunk/boost/math/concepts/real_concept.hpp
==============================================================================
--- trunk/boost/math/concepts/real_concept.hpp (original)
+++ trunk/boost/math/concepts/real_concept.hpp 2007-10-09 07:15:11 EDT (Tue, 09 Oct 2007)
@@ -196,7 +196,7 @@
 inline real_concept ceil(real_concept a)
 { return std::ceil(a.value()); }
 inline real_concept fmod(real_concept a, real_concept b)
-{ return boost::math::tools::fmod_workaround(a.value(), b.value()); }
+{ return fmodl(a.value(), b.value()); }
 inline real_concept cosh(real_concept a)
 { return std::cosh(a.value()); }
 inline real_concept exp(real_concept a)

Modified: trunk/boost/math/concepts/std_real_concept.hpp
==============================================================================
--- trunk/boost/math/concepts/std_real_concept.hpp (original)
+++ trunk/boost/math/concepts/std_real_concept.hpp 2007-10-09 07:15:11 EDT (Tue, 09 Oct 2007)
@@ -195,7 +195,7 @@
 inline boost::math::concepts::std_real_concept ceil(boost::math::concepts::std_real_concept a)
 { return std::ceil(a.value()); }
 inline boost::math::concepts::std_real_concept fmod(boost::math::concepts::std_real_concept a, boost::math::concepts::std_real_concept b)
-{ return boost::math::tools::fmod_workaround(a.value(), b.value()); }
+{ return fmodl(a.value(), b.value()); }
 inline boost::math::concepts::std_real_concept cosh(boost::math::concepts::std_real_concept a)
 { return std::cosh(a.value()); }
 inline boost::math::concepts::std_real_concept exp(boost::math::concepts::std_real_concept a)

Modified: trunk/boost/math/special_functions/ellint_1.hpp
==============================================================================
--- trunk/boost/math/special_functions/ellint_1.hpp (original)
+++ trunk/boost/math/special_functions/ellint_1.hpp 2007-10-09 07:15:11 EDT (Tue, 09 Oct 2007)
@@ -17,6 +17,7 @@
 #include <boost/math/special_functions/ellint_rf.hpp>
 #include <boost/math/constants/constants.hpp>
 #include <boost/math/policies/error_handling.hpp>
+#include <boost/math/tools/workaround.hpp>
 
 // Elliptic integrals (complete and incomplete) of the first kind
 // Carlson, Numerische Mathematik, vol 33, 1 (1979)

Modified: trunk/boost/math/special_functions/ellint_2.hpp
==============================================================================
--- trunk/boost/math/special_functions/ellint_2.hpp (original)
+++ trunk/boost/math/special_functions/ellint_2.hpp 2007-10-09 07:15:11 EDT (Tue, 09 Oct 2007)
@@ -18,6 +18,7 @@
 #include <boost/math/special_functions/ellint_rd.hpp>
 #include <boost/math/constants/constants.hpp>
 #include <boost/math/policies/error_handling.hpp>
+#include <boost/math/tools/workaround.hpp>
 
 // Elliptic integrals (complete and incomplete) of the second kind
 // Carlson, Numerische Mathematik, vol 33, 1 (1979)

Modified: trunk/boost/math/special_functions/ellint_3.hpp
==============================================================================
--- trunk/boost/math/special_functions/ellint_3.hpp (original)
+++ trunk/boost/math/special_functions/ellint_3.hpp 2007-10-09 07:15:11 EDT (Tue, 09 Oct 2007)
@@ -21,6 +21,7 @@
 #include <boost/math/special_functions/log1p.hpp>
 #include <boost/math/constants/constants.hpp>
 #include <boost/math/policies/error_handling.hpp>
+#include <boost/math/tools/workaround.hpp>
 
 // Elliptic integrals (complete and incomplete) of the third kind
 // Carlson, Numerische Mathematik, vol 33, 1 (1979)

Modified: trunk/boost/math/special_functions/spherical_harmonic.hpp
==============================================================================
--- trunk/boost/math/special_functions/spherical_harmonic.hpp (original)
+++ trunk/boost/math/special_functions/spherical_harmonic.hpp 2007-10-09 07:15:11 EDT (Tue, 09 Oct 2007)
@@ -8,6 +8,7 @@
 #define BOOST_MATH_SPECIAL_SPHERICAL_HARMONIC_HPP
 
 #include <boost/math/special_functions/legendre.hpp>
+#include <boost/math/tools/workaround.hpp>
 #include <complex>
 
 namespace boost{

Modified: trunk/boost/math/tools/config.hpp
==============================================================================
--- trunk/boost/math/tools/config.hpp (original)
+++ trunk/boost/math/tools/config.hpp 2007-10-09 07:15:11 EDT (Tue, 09 Oct 2007)
@@ -1,3 +1,8 @@
+// Copyright (c) 2006-7 John Maddock
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
 #ifndef BOOST_MATH_TOOLS_CONFIG_HPP
 #define BOOST_MATH_TOOLS_CONFIG_HPP
 
@@ -108,24 +113,6 @@
 {
    return (std::max)((std::max)(a, b), (std::max)(c, d));
 }
-//
-// We call this short forwarding function so that we can work around a bug
-// on Darwin that causes std::fmod to return a NaN. The test case is:
-// std::fmod(1185.0L, 1.5L);
-//
-template <class T>
-inline T fmod_workaround(T a, T b)
-{
- BOOST_MATH_STD_USING
- return fmod(a, b);
-}
-#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106))
-template <>
-inline long double fmod_workaround(long double a, long double b)
-{
- return ::fmodl(a, b);
-}
-#endif
 } // namespace tools
 }} // namespace boost namespace math
 

Added: trunk/boost/math/tools/workaround.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/math/tools/workaround.hpp 2007-10-09 07:15:11 EDT (Tue, 09 Oct 2007)
@@ -0,0 +1,33 @@
+// Copyright (c) 2006-7 John Maddock
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_MATH_TOOLS_WORHAROUND_HPP
+#define BOOST_MATH_TOOLS_WORHAROUND_HPP
+
+#include <boost/math/tools/config.hpp>
+
+namespace boost{ namespace math{ namespace tools{
+//
+// We call this short forwarding function so that we can work around a bug
+// on Darwin that causes std::fmod to return a NaN. The test case is:
+// std::fmod(1185.0L, 1.5L);
+//
+template <class T>
+inline T fmod_workaround(T a, T b)
+{
+ BOOST_MATH_STD_USING
+ return fmod(a, b);
+}
+#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106))
+template <>
+inline long double fmod_workaround(long double a, long double b)
+{
+ return ::fmodl(a, b);
+}
+#endif
+
+}}} // namespaces
+
+#endif // BOOST_MATH_TOOLS_WORHAROUND_HPP


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk