|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61837 - in trunk: boost/math boost/math/special_functions libs/math/config libs/math/test
From: john_at_[hidden]
Date: 2010-05-07 11:36:10
Author: johnmaddock
Date: 2010-05-07 11:36:09 EDT (Fri, 07 May 2010)
New Revision: 61837
URL: http://svn.boost.org/trac/boost/changeset/61837
Log:
Fix failures when used with an expression-template enabled number type such as the gmpxx clases.
Add additional concept check for integer code using gmp classes.
Fixes #4139.
Added:
trunk/libs/math/config/has_gmpxx.cpp (contents, props changed)
trunk/libs/math/test/test_common_factor_gmpxx.cpp (contents, props changed)
Text files modified:
trunk/boost/math/common_factor_rt.hpp | 8 ++++----
trunk/boost/math/special_functions/cbrt.hpp | 7 ++++++-
trunk/libs/math/config/Jamfile.v2 | 3 +++
trunk/libs/math/test/Jamfile.v2 | 1 +
4 files changed, 14 insertions(+), 5 deletions(-)
Modified: trunk/boost/math/common_factor_rt.hpp
==============================================================================
--- trunk/boost/math/common_factor_rt.hpp (original)
+++ trunk/boost/math/common_factor_rt.hpp 2010-05-07 11:36:09 EDT (Fri, 07 May 2010)
@@ -78,8 +78,8 @@
RingType
gcd_euclidean
(
- RingType a,
- RingType b
+ RingType a,
+ RingType b
)
{
// Avoid repeated construction
@@ -116,7 +116,7 @@
IntegerType const zero = static_cast<IntegerType>( 0 );
IntegerType const result = gcd_euclidean( a, b );
- return ( result < zero ) ? -result : result;
+ return ( result < zero ) ? static_cast<IntegerType>(-result) : result;
}
// Greatest common divisor for unsigned binary integers
@@ -212,7 +212,7 @@
IntegerType const zero = static_cast<IntegerType>( 0 );
IntegerType const result = lcm_euclidean( a, b );
- return ( result < zero ) ? -result : result;
+ return ( result < zero ) ? static_cast<IntegerType>(-result) : result;
}
// Function objects to find the best way of computing GCD or LCM
Modified: trunk/boost/math/special_functions/cbrt.hpp
==============================================================================
--- trunk/boost/math/special_functions/cbrt.hpp (original)
+++ trunk/boost/math/special_functions/cbrt.hpp 2010-05-07 11:36:09 EDT (Fri, 07 May 2010)
@@ -24,11 +24,16 @@
namespace detail
{
+struct big_int_type
+{
+ operator boost::uintmax_t()const;
+};
+
template <class T>
struct largest_cbrt_int_type
{
typedef typename mpl::if_<
- boost::is_convertible<boost::uintmax_t, T>,
+ boost::is_convertible<big_int_type, T>,
boost::uintmax_t,
unsigned int
>::type type;
Modified: trunk/libs/math/config/Jamfile.v2
==============================================================================
--- trunk/libs/math/config/Jamfile.v2 (original)
+++ trunk/libs/math/config/Jamfile.v2 2010-05-07 11:36:09 EDT (Fri, 07 May 2010)
@@ -13,10 +13,13 @@
obj has_mpfr_class : has_mpfr_class.cpp :
<include>$(gmp_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx ;
obj has_ntl_rr : has_ntl_rr.cpp : <include>$(ntl-path)/include ;
+obj has_gmpxx : has_gmpxx.cpp :
+ <include>$(gmp_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx ;
explicit has_long_double_support ;
explicit has_mpfr_class ;
explicit has_ntl_rr ;
+explicit has_gmpxx ;
Added: trunk/libs/math/config/has_gmpxx.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/math/config/has_gmpxx.cpp 2010-05-07 11:36:09 EDT (Fri, 07 May 2010)
@@ -0,0 +1,7 @@
+// Copyright John Maddock 2008.
+// 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)
+
+#include <gmpxx.h>
+
Modified: trunk/libs/math/test/Jamfile.v2
==============================================================================
--- trunk/libs/math/test/Jamfile.v2 (original)
+++ trunk/libs/math/test/Jamfile.v2 2010-05-07 11:36:09 EDT (Fri, 07 May 2010)
@@ -752,6 +752,7 @@
compile ntl_concept_check.cpp : [ check-target-builds ../config//has_ntl_rr : : <build>no ] ;
compile mpfr_concept_check.cpp : [ check-target-builds ../config//has_mpfr_class : : <build>no ] ;
+compile test_common_factor_gmpxx.cpp : [ check-target-builds ../config//has_gmpxx : : <build>no ] ;
build-project ../example ;
Added: trunk/libs/math/test/test_common_factor_gmpxx.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/math/test/test_common_factor_gmpxx.cpp 2010-05-07 11:36:09 EDT (Fri, 07 May 2010)
@@ -0,0 +1,22 @@
+
+// (C) Copyright John Maddock 2010.
+// 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)
+
+#include <gmpxx.h>
+#include <boost/math/common_factor.hpp>
+
+template class boost::math::gcd_evaluator<mpz_class>;
+template class boost::math::lcm_evaluator<mpz_class>;
+template mpz_class boost::math::gcd(const mpz_class&, const mpz_class&);
+template mpz_class boost::math::lcm(const mpz_class&, const mpz_class&);
+
+template mpz_class boost::math::detail::gcd_euclidean(const mpz_class, const mpz_class);
+template mpz_class boost::math::detail::gcd_integer(const mpz_class&, const mpz_class&);
+template mpz_class boost::math::detail::lcm_euclidean(const mpz_class&, const mpz_class&);
+template mpz_class boost::math::detail::lcm_integer(const mpz_class&, const mpz_class&);
+
+int main()
+{
+}
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