Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-10-18 11:37:02


Author: johnmaddock
Date: 2007-10-18 11:37:01 EDT (Thu, 18 Oct 2007)
New Revision: 40155
URL: http://svn.boost.org/trac/boost/changeset/40155

Log:
Workaround for real_concept when there are no long double math functions.
Added HP-UX on PA RISC to list of platforms with no long double overloads.
Added macro expansion suppression code to declarations of sign and to it's usages (an AIX fix).
Text files modified:
   trunk/boost/math/concepts/real_concept.hpp | 3 +++
   trunk/boost/math/concepts/std_real_concept.hpp | 6 ++++++
   trunk/boost/math/distributions/detail/inv_discrete_quantile.hpp | 6 +++---
   trunk/boost/math/special_functions/sign.hpp | 7 ++++---
   trunk/boost/math/tools/config.hpp | 2 +-
   trunk/boost/math/tools/toms748_solve.hpp | 4 ++--
   6 files changed, 19 insertions(+), 9 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-18 11:37:01 EDT (Thu, 18 Oct 2007)
@@ -28,6 +28,7 @@
 #include <ostream>
 #include <istream>
 #include <cmath>
+#include <math.h> // fmodl
 
 #ifndef BOOST_MATH_REAL_CONCEPT_HPP
 #define BOOST_MATH_REAL_CONCEPT_HPP
@@ -194,8 +195,10 @@
 { return std::atan2(a.value(), b.value()); }
 inline real_concept ceil(real_concept a)
 { return std::ceil(a.value()); }
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
 inline real_concept fmod(real_concept a, real_concept b)
 { return fmodl(a.value(), b.value()); }
+#endif
 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-18 11:37:01 EDT (Thu, 18 Oct 2007)
@@ -25,6 +25,7 @@
 #include <ostream>
 #include <istream>
 #include <cmath>
+#include <math.h> // fmodl
 
 #ifndef BOOST_MATH_STD_REAL_CONCEPT_HPP
 #define BOOST_MATH_STD_REAL_CONCEPT_HPP
@@ -194,8 +195,13 @@
 { return std::atan2(a.value(), b.value()); }
 inline boost::math::concepts::std_real_concept ceil(boost::math::concepts::std_real_concept a)
 { return std::ceil(a.value()); }
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
 inline boost::math::concepts::std_real_concept fmod(boost::math::concepts::std_real_concept a, boost::math::concepts::std_real_concept b)
 { return fmodl(a.value(), b.value()); }
+#else
+inline boost::math::concepts::std_real_concept fmod(boost::math::concepts::std_real_concept a, boost::math::concepts::std_real_concept b)
+{ return std::fmod(a.value(), b.value()); }
+#endif
 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/distributions/detail/inv_discrete_quantile.hpp
==============================================================================
--- trunk/boost/math/distributions/detail/inv_discrete_quantile.hpp (original)
+++ trunk/boost/math/distributions/detail/inv_discrete_quantile.hpp 2007-10-18 11:37:01 EDT (Thu, 18 Oct 2007)
@@ -200,7 +200,7 @@
    // If the root hasn't been bracketed yet, try again
    // using the multiplier this time:
    //
- if(sign(fb) == sign(fa))
+ if((boost::math::sign)(fb) == (boost::math::sign)(fa))
    {
       if(fa < 0)
       {
@@ -208,7 +208,7 @@
          // Zero is to the right of x2, so walk upwards
          // until we find it:
          //
- while(sign(fb) == sign(fa))
+ while((boost::math::sign)(fb) == (boost::math::sign)(fa))
          {
             if(count == 0)
                policies::raise_evaluation_error(function, "Unable to bracket root, last nearest value was %1%", b, policy_type());
@@ -228,7 +228,7 @@
          // Zero is to the left of a, so walk downwards
          // until we find it:
          //
- while(sign(fb) == sign(fa))
+ while((boost::math::sign)(fb) == (boost::math::sign)(fa))
          {
             if(fabs(a) < tools::min_value<value_type>())
             {

Modified: trunk/boost/math/special_functions/sign.hpp
==============================================================================
--- trunk/boost/math/special_functions/sign.hpp (original)
+++ trunk/boost/math/special_functions/sign.hpp 2007-10-18 11:37:01 EDT (Thu, 18 Oct 2007)
@@ -7,23 +7,24 @@
 #define BOOST_MATH_TOOLS_SIGN_HPP
 
 #include <boost/math/tools/config.hpp>
+#include <boost/math/special_functions/math_fwd.hpp>
 
 namespace boost{ namespace math{
 
 template <class T>
-inline int sign(const T& z)
+inline int sign BOOST_NO_MACRO_EXPAND(const T& z)
 {
    return (z == 0) ? 0 : (z < 0) ? -1 : 1;
 }
 
 template <class T>
-inline int signbit(const T& z)
+inline int signbit BOOST_NO_MACRO_EXPAND(const T& z)
 {
    return (z < 0) ? 1 : 0;
 }
 
 template <class T>
-inline T copysign(const T& x, const T& y)
+inline T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y)
 {
    BOOST_MATH_STD_USING
    return fabs(x) * boost::math::sign(y);

Modified: trunk/boost/math/tools/config.hpp
==============================================================================
--- trunk/boost/math/tools/config.hpp (original)
+++ trunk/boost/math/tools/config.hpp 2007-10-18 11:37:01 EDT (Thu, 18 Oct 2007)
@@ -18,7 +18,7 @@
 
 #include <boost/math/tools/user.hpp>
 
-#if defined(__CYGWIN__) || defined(__FreeBSD__)
+#if defined(__CYGWIN__) || defined(__FreeBSD__) || defined(_PA_RISC1_1)
 # define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
 #endif
 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))

Modified: trunk/boost/math/tools/toms748_solve.hpp
==============================================================================
--- trunk/boost/math/tools/toms748_solve.hpp (original)
+++ trunk/boost/math/tools/toms748_solve.hpp 2007-10-18 11:37:01 EDT (Thu, 18 Oct 2007)
@@ -494,7 +494,7 @@
       // Zero is to the right of b, so walk upwards
       // until we find it:
       //
- while(sign(fb) == sign(fa))
+ while((boost::math::sign)(fb) == (boost::math::sign)(fa))
       {
          if(count == 0)
             policies::raise_evaluation_error(function, "Unable to bracket root, last nearest value was %1%", b, pol);
@@ -521,7 +521,7 @@
       // Zero is to the left of a, so walk downwards
       // until we find it:
       //
- while(sign(fb) == sign(fa))
+ while((boost::math::sign)(fb) == (boost::math::sign)(fa))
       {
          if(fabs(a) < tools::min_value<T>())
          {


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