|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77971 - in sandbox/big_number: boost/multiprecision/detail libs/multiprecision/example libs/multiprecision/test
From: john_at_[hidden]
Date: 2012-04-14 12:51:03
Author: johnmaddock
Date: 2012-04-14 12:51:02 EDT (Sat, 14 Apr 2012)
New Revision: 77971
URL: http://svn.boost.org/trac/boost/changeset/77971
Log:
Fix ldexp/frexp in default_ops.hpp. Improve 64-bit platform detection in cpp_int_core.hpp. Get examples building with GCC
Text files modified:
sandbox/big_number/boost/multiprecision/detail/cpp_int_core.hpp | 2 +-
sandbox/big_number/boost/multiprecision/detail/default_ops.hpp | 37 +++++++++++++++++++++++--------------
sandbox/big_number/libs/multiprecision/example/floating_point_examples.cpp | 10 +++++-----
sandbox/big_number/libs/multiprecision/test/Jamfile.v2 | 2 +-
4 files changed, 30 insertions(+), 21 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/detail/cpp_int_core.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/cpp_int_core.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/cpp_int_core.hpp 2012-04-14 12:51:02 EDT (Sat, 14 Apr 2012)
@@ -8,7 +8,7 @@
namespace boost{ namespace multiprecision{
-#if defined(__GNUC__) && !defined(BOOST_INTEL) && defined(__x86_64__)
+#if defined(__GNUC__) && !defined(BOOST_INTEL) && defined(__WORDSIZE) && (__WORDSIZE == 64)
typedef boost::uint64_t limb_type;
typedef boost::int64_t signed_limb_type;
Modified: sandbox/big_number/boost/multiprecision/detail/default_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/default_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/default_ops.hpp 2012-04-14 12:51:02 EDT (Sat, 14 Apr 2012)
@@ -1153,20 +1153,7 @@
}\
-#define HETERO_BINARY_OP_FUNCTOR(func, Arg2)\
-namespace detail{\
-template <class Backend> \
-struct BOOST_JOIN(func, _funct)\
-{\
- void operator()(Backend& result, Backend const& arg, Arg2 a)const\
- {\
- using default_ops:: BOOST_JOIN(eval_,func);\
- BOOST_JOIN(eval_,func)(result, arg, a);\
- }\
-};\
-\
-}\
-\
+#define HETERO_BINARY_OP_FUNCTOR_B(func, Arg2)\
template <class tag, class A1, class A2, class A3> \
inline detail::mp_exp<\
detail::function\
@@ -1216,6 +1203,24 @@
return result;\
}\
+#define HETERO_BINARY_OP_FUNCTOR(func, Arg2)\
+namespace detail{\
+template <class Backend> \
+struct BOOST_JOIN(func, _funct)\
+{\
+ template <class Arg>\
+ void operator()(Backend& result, Backend const& arg, Arg a)const\
+ {\
+ using default_ops:: BOOST_JOIN(eval_,func);\
+ BOOST_JOIN(eval_,func)(result, arg, a);\
+ }\
+};\
+\
+}\
+\
+HETERO_BINARY_OP_FUNCTOR_B(func, Arg2)
+
+
UNARY_OP_FUNCTOR(abs)
UNARY_OP_FUNCTOR(fabs)
UNARY_OP_FUNCTOR(sqrt)
@@ -1238,6 +1243,10 @@
HETERO_BINARY_OP_FUNCTOR(ldexp, int)
HETERO_BINARY_OP_FUNCTOR(frexp, int*)
+HETERO_BINARY_OP_FUNCTOR_B(ldexp, long)
+HETERO_BINARY_OP_FUNCTOR_B(frexp, long*)
+HETERO_BINARY_OP_FUNCTOR_B(ldexp, long long)
+HETERO_BINARY_OP_FUNCTOR_B(frexp, long long*)
BINARY_OP_FUNCTOR(pow)
BINARY_OP_FUNCTOR(fmod)
BINARY_OP_FUNCTOR(atan2)
Modified: sandbox/big_number/libs/multiprecision/example/floating_point_examples.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/example/floating_point_examples.cpp (original)
+++ sandbox/big_number/libs/multiprecision/example/floating_point_examples.cpp 2012-04-14 12:51:02 EDT (Sat, 14 Apr 2012)
@@ -441,7 +441,7 @@
/*`
Calling the function like so:
- std::cout << std::setprecision(std::numeric_limits<::mp_type>::digits10) << std::scientific;
+ std::cout << std::setprecision(std::numeric_limits< ::mp_type>::digits10) << std::scientific;
std::cout << mysin(mp_type(1)) << std::endl;
Yields the expected output:
@@ -657,9 +657,9 @@
//]
- std::cout << std::setprecision(std::numeric_limits<::mp_type>::digits10) << std::scientific;
- std::cout << mysin(boost::math::constants::pi<::mp_type>() / 4) << std::endl;
- std::cout << boost::multiprecision::sin(boost::math::constants::pi<::mp_type>() / 4) << std::endl;
+ std::cout << std::setprecision(std::numeric_limits< ::mp_type>::digits10) << std::scientific;
+ std::cout << mysin(boost::math::constants::pi< ::mp_type>() / 4) << std::endl;
+ std::cout << boost::multiprecision::sin(boost::math::constants::pi< ::mp_type>() / 4) << std::endl;
return 0;
}
@@ -683,4 +683,4 @@
2.70670566473225383787998989944968806815253190143120e-01
7.0710678118654752440084436210484903928483593768847403658833986900e-01
7.0710678118654752440084436210484903928483593768847403658833986900e-01
-*/
\ No newline at end of file
+*/
Modified: sandbox/big_number/libs/multiprecision/test/Jamfile.v2
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/Jamfile.v2 (original)
+++ sandbox/big_number/libs/multiprecision/test/Jamfile.v2 2012-04-14 12:51:02 EDT (Sat, 14 Apr 2012)
@@ -665,7 +665,7 @@
: # input files
: # requirements
[ check-target-builds ../config//has_tommath : : <build>no ] ;
-run ../example/floating_point_examples.cpp ;
+run ../example/floating_point_examples.cpp : : : <toolset>gcc:<cxxflags>-std=c++0x ;
if $(enable-specfun)
{
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