|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81324 - in sandbox/big_number: boost/multiprecision boost/multiprecision/cpp_int boost/multiprecision/detail boost/multiprecision/traits libs/multiprecision/doc libs/multiprecision/doc/html libs/multiprecision/doc/html/boost_multiprecision libs/multiprecision/doc/html/boost_multiprecision/indexes libs/multiprecision/doc/html/boost_multiprecision/map libs/multiprecision/doc/html/boost_multiprecision/ref libs/multiprecision/doc/html/boost_multiprecision/tut/floats libs/multiprecision/performance libs/multiprecision/test
From: john_at_[hidden]
Date: 2012-11-13 12:12:24
Author: johnmaddock
Date: 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
New Revision: 81324
URL: http://svn.boost.org/trac/boost/changeset/81324
Log:
Fix missing number constructor.
Fix is_explicitly_convertible to take account of the generic conversions.
Change sf_performance to use multiple files so we can actually compile the thing!
Minor doc updates.
Suppress some more warnings.
Added:
sandbox/big_number/libs/multiprecision/performance/sf_performance_basic.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel1.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel2.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel3.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel4.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel5.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel6.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_nct.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_nct1.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_nct2.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_nct3.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_nct4.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_nct5.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_nct6.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/performance/sf_performance_poly.cpp (contents, props changed)
Text files modified:
sandbox/big_number/boost/multiprecision/cpp_int.hpp | 2
sandbox/big_number/boost/multiprecision/cpp_int/misc.hpp | 9
sandbox/big_number/boost/multiprecision/detail/generic_interconvert.hpp | 2
sandbox/big_number/boost/multiprecision/number.hpp | 7
sandbox/big_number/boost/multiprecision/rational_adapter.hpp | 2
sandbox/big_number/boost/multiprecision/traits/explicit_conversion.hpp | 37 +++
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html | 7
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/faq.html | 2
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html | 3
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html | 17
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html | 24 +
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html | 9
sandbox/big_number/libs/multiprecision/doc/html/index.html | 2
sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk | 34 ++-
sandbox/big_number/libs/multiprecision/performance/Jamfile.v2 | 4
sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp | 412 ---------------------------------------
sandbox/big_number/libs/multiprecision/test/test_atan.cpp | 4
sandbox/big_number/libs/multiprecision/test/test_float_io.cpp | 6
sandbox/big_number/libs/multiprecision/test/test_int_io.cpp | 4
sandbox/big_number/libs/multiprecision/test/test_native_integer.cpp | 2
sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp | 4
sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp | 1
sandbox/big_number/libs/multiprecision/test/test_round.cpp | 4
27 files changed, 159 insertions(+), 455 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/cpp_int.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_int.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_int.hpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -29,7 +29,7 @@
#ifdef BOOST_MSVC
// warning C4127: conditional expression is constant
#pragma warning(push)
-#pragma warning(disable:4127 4351 4293 4996 4307)
+#pragma warning(disable:4127 4351 4293 4996 4307 4702)
#endif
template <unsigned MinBits = 0, unsigned MaxBits = 0, cpp_integer_type SignType = signed_magnitude, cpp_int_check_type Checked = unchecked, class Allocator = typename mpl::if_c<MinBits && (MinBits == MaxBits), void, std::allocator<limb_type> >::type >
Modified: sandbox/big_number/boost/multiprecision/cpp_int/misc.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_int/misc.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_int/misc.hpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -8,6 +8,11 @@
#ifndef BOOST_MP_CPP_INT_MISC_HPP
#define BOOST_MP_CPP_INT_MISC_HPP
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4702)
+#endif
+
namespace boost{ namespace multiprecision{ namespace backends{
template <class R, class CppInt>
@@ -303,6 +308,10 @@
*result = static_cast<R>(*val.limbs());
}
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
}}} // namespaces
#endif
Modified: sandbox/big_number/boost/multiprecision/detail/generic_interconvert.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/generic_interconvert.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/generic_interconvert.hpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -77,7 +77,7 @@
t.negate();
// Pick off the first limb:
limb_type limb;
- limb_type mask = ~static_cast<limb_type>(0);
+ limb_type mask = static_cast<limb_type>(~static_cast<limb_type>(0));
From fl;
eval_bitwise_and(fl, t, mask);
eval_convert_to(&limb, fl);
Modified: sandbox/big_number/boost/multiprecision/number.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/number.hpp (original)
+++ sandbox/big_number/boost/multiprecision/number.hpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -176,6 +176,13 @@
{
*this = e;
}
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+ explicit number(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e,
+ typename enable_if_c<!is_convertible<typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type, self_type>::value
+ && boost::multiprecision::detail::is_explicitly_convertible<typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type, self_type>::value>::type* = 0)
+ {
+ assign(e);
+ }
#ifndef BOOST_NO_RVALUE_REFERENCES
BOOST_FORCEINLINE BOOST_CONSTEXPR number(number&& r) BOOST_NOEXCEPT : m_backend(static_cast<Backend&&>(r.m_backend)){}
Modified: sandbox/big_number/boost/multiprecision/rational_adapter.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/rational_adapter.hpp (original)
+++ sandbox/big_number/boost/multiprecision/rational_adapter.hpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -13,7 +13,7 @@
#include <boost/multiprecision/number.hpp>
#ifdef BOOST_MSVC
# pragma warning(push)
-# pragma warning(disable:4512)
+# pragma warning(disable:4512 4127)
#endif
#include <boost/rational.hpp>
#ifdef BOOST_MSVC
Modified: sandbox/big_number/boost/multiprecision/traits/explicit_conversion.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/traits/explicit_conversion.hpp (original)
+++ sandbox/big_number/boost/multiprecision/traits/explicit_conversion.hpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -17,6 +17,40 @@
struct dummy_size{};
template<typename S, typename T>
+struct has_generic_interconversion
+{
+ typedef typename mpl::if_c<
+ is_number<S>::value && is_number<T>::value,
+ typename mpl::if_c<
+ number_category<S>::value == number_kind_integer,
+ typename mpl::if_c<
+ number_category<T>::value == number_kind_integer
+ || number_category<T>::value == number_kind_floating_point
+ || number_category<T>::value == number_kind_rational
+ || number_category<T>::value == number_kind_fixed_point,
+ mpl::true_,
+ mpl::false_
+ >::type,
+ typename mpl::if_c<
+ number_category<S>::value == number_kind_rational,
+ typename mpl::if_c<
+ number_category<T>::value == number_kind_rational
+ || number_category<T>::value == number_kind_rational,
+ mpl::true_,
+ mpl::false_
+ >::type,
+ typename mpl::if_c<
+ number_category<T>::value == number_kind_floating_point,
+ mpl::true_,
+ mpl::false_
+ >::type
+ >::type
+ >::type,
+ mpl::false_
+ >::type type;
+};
+
+template<typename S, typename T>
struct is_explicitly_convertible_imp
{
#ifndef BOOST_NO_SFINAE_EXPR
@@ -30,7 +64,8 @@
typedef boost::integral_constant<bool,value> type;
#else
- typedef typename boost::is_convertible<S, T>::type type;
+ typedef typename has_generic_interconversion<S, T>::type gen_type;
+ typedef mpl::bool_<boost::is_convertible<S, T>::value || gen_type::value> type;
#endif
};
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="../indexes.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s02.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id961630">
+<div class="section id988910">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id961630"></a>Function Index</h3></div></div></div>
+<a name="id988910"></a>Function Index</h3></div></div></div>
<p><a class="link" href="s01.html#idx_id_0">A</a> <a class="link" href="s01.html#idx_id_1">B</a> <a class="link" href="s01.html#idx_id_2">C</a> <a class="link" href="s01.html#idx_id_3">D</a> <a class="link" href="s01.html#idx_id_4">E</a> <a class="link" href="s01.html#idx_id_5">F</a> <a class="link" href="s01.html#idx_id_7">I</a> <a class="link" href="s01.html#idx_id_8">L</a> <a class="link" href="s01.html#idx_id_9">M</a> <a class="link" href="s01.html#idx_id_12">P</a> <a class="link" href="s01.html#idx_id_13">R</a> <a class="link" href="s01.html#idx_id_14">S</a> <a class="link" href="s01.html#idx_id_15">T</a> <a class="link" href="s01.html#idx_id_17">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s01.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s03.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id966675">
+<div class="section id994045">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id966675"></a>Class Index</h3></div></div></div>
+<a name="id994045"></a>Class Index</h3></div></div></div>
<p><a class="link" href="s02.html#idx_id_20">C</a> <a class="link" href="s02.html#idx_id_22">E</a> <a class="link" href="s02.html#idx_id_24">G</a> <a class="link" href="s02.html#idx_id_25">I</a> <a class="link" href="s02.html#idx_id_27">M</a> <a class="link" href="s02.html#idx_id_28">N</a> <a class="link" href="s02.html#idx_id_33">T</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s02.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s04.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id967092">
+<div class="section id994462">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id967092"></a>Typedef Index</h3></div></div></div>
+<a name="id994462"></a>Typedef Index</h3></div></div></div>
<p><a class="link" href="s03.html#idx_id_38">C</a> <a class="link" href="s03.html#idx_id_43">I</a> <a class="link" href="s03.html#idx_id_44">L</a> <a class="link" href="s03.html#idx_id_45">M</a> <a class="link" href="s03.html#idx_id_50">S</a> <a class="link" href="s03.html#idx_id_51">T</a> <a class="link" href="s03.html#idx_id_52">U</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -12,9 +12,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s03.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a>
</div>
-<div class="section id968092">
+<div class="section id995462">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id968092"></a>Index</h3></div></div></div>
+<a name="id995462"></a>Index</h3></div></div></div>
<p><a class="link" href="s04.html#idx_id_54">A</a> <a class="link" href="s04.html#idx_id_55">B</a> <a class="link" href="s04.html#idx_id_56">C</a> <a class="link" href="s04.html#idx_id_57">D</a> <a class="link" href="s04.html#idx_id_58">E</a> <a class="link" href="s04.html#idx_id_59">F</a> <a class="link" href="s04.html#idx_id_60">G</a> <a class="link" href="s04.html#idx_id_61">I</a> <a class="link" href="s04.html#idx_id_62">L</a> <a class="link" href="s04.html#idx_id_63">M</a> <a class="link" href="s04.html#idx_id_64">N</a> <a class="link" href="s04.html#idx_id_65">O</a> <a class="link" href="s04.html#idx_id_66">P</a> <a class="link" href="s04.html#idx_id_67">R</a> <a class="link" href="s04.html#idx_id_68">S</a> <a class="link" href="s04.html#idx_id_69">T</a> <a class="link" href="s04.html#idx_id_70">U</a> <a class="link" href="s04.html#idx_id_71">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -48,6 +48,13 @@
is always available (if somewhat slower).
</p>
<p>
+ Should you just wish to cut to the chase and use a fully Boost-licensed number
+ type, then skip to <a class="link" href="tut/ints/cpp_int.html" title="cpp_int">cpp_int</a>
+ for multiprecision integers, <a class="link" href="tut/floats/cpp_dec_float.html" title="cpp_dec_float">cpp_dec_float</a>
+ for multiprecision floating point types and <a class="link" href="tut/rational/cpp_rational.html" title="cpp_rational">cpp_rational</a>
+ for rational types.
+ </p>
+<p>
The library is often used via one of the predefined typedefs: for example if
you wanted an <a href="http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic" target="_top">arbitrary
precision</a> integer type using GMP
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/faq.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/faq.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/faq.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -77,7 +77,7 @@
<dt><span class="term">Why can't I negate an unsigned type?</span></dt>
<dd><p>
The unary negation operator is deliberately disabled for unsigned integer
- types as it's use would almost always be a programming error.
+ types as its use would almost always be a programming error.
</p></dd>
<dt><span class="term">Why doesn't the library use proto?</span></dt>
<dd><p>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -67,6 +67,9 @@
Added section on mixed precision arithmetic, and added support for operations
yielding a higher precision result than either of the arguments.
</li>
+<li class="listitem">
+ Added overloads of integer-specific functions for built in integer types.
+ </li>
</ul></div>
<h5>
<a name="boost_multiprecision.map.hist.h1"></a>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -51,26 +51,27 @@
<li class="listitem">
We can reuse temporaries in multiple subtrees (temporary caching).
</li>
+<li class="listitem">
+ cpp_dec_float should round to nearest.
+ </li>
+<li class="listitem">
+ A 2's complement fixed precision int that uses exactly N bits and no
+ more.
+ </li>
</ul></div>
<p>
Things requested in review:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
- A 2's complement fixed precision int that uses exactly N bits and no
- more.
- </li>
-<li class="listitem">
The performances of mp_number<a_trivial_adaptor<float>, false>respect
to float and mp_number<a_trivial_adaptor<int>, false> and
int should be given to show the cost of using the generic interface (Mostly
done, just need to update docs to the latest results).
</li>
<li class="listitem">
- cpp_dec_float should round to nearest.
- </li>
-<li class="listitem">
- Should we provide min/max overloads for expression templates?
+ Should we provide min/max overloads for expression templates? (Not done
+ - we can't overload functions declared in the std namespace :-( ).
</li>
<li class="listitem">
The rounding applied when converting must be documented (Done).
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -1093,21 +1093,33 @@
<span class="phrase"><a name="boost_multiprecision.ref.number.integer_functions"></a></span><a class="link" href="number.html#boost_multiprecision.ref.number.integer_functions">Integer
functions</a>
</h5>
+<p>
+ In addition to functioning with types from this library, these functions
+ are also overloaded for built in integer types if you include <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">integer</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ Further, when used with fixed precision types (whether built in integers
+ or multiprecision ones), the functions will promote to a wider type internally
+ when the algorithm requires it. Versions overloaded for built in integer
+ types return that integer type rather than an expression template.
+ </p>
<pre class="programlisting"><span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">pow</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&</span> <span class="identifier">b</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">p</span><span class="special">);</span>
</pre>
<p>
Returns <span class="emphasis"><em>b<sup>p</sup></em></span> as an expression template. Note that this
function should be used with extreme care as the result can grow so large
as to take "effectively forever" to compute, or else simply run
- the host machine out of memory.
+ the host machine out of memory. This is the one function in this category
+ that is not overloaded for built in integer types, further, it's probably
+ not a good idea to use it with fixed precision <code class="computeroutput"><span class="identifier">cpp_int</span></code>'s
+ either.
</p>
<pre class="programlisting"><span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">powm</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&</span> <span class="identifier">b</span><span class="special">,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&</span> <span class="identifier">p</span><span class="special">,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&</span> <span class="identifier">m</span><span class="special">);</span>
</pre>
<p>
- Returns <span class="emphasis"><em>b<sup>p</sup> mod m</em></span> as an expression template.
+ Returns <span class="emphasis"><em>b<sup>p</sup> mod m</em></span> as an expression template. Fixed precision
+ types are promoted internally to ensure accuracy.
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">expression_template_option</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span>
-<span class="keyword">bool</span> <span class="identifier">divide_qr</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&</span> <span class="identifier">y</span><span class="special">,</span>
+<span class="keyword">void</span> <span class="identifier">divide_qr</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&</span> <span class="identifier">y</span><span class="special">,</span>
<span class="identifier">number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">q</span><span class="special">,</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">r</span><span class="special">);</span>
</pre>
<p>
@@ -1128,6 +1140,9 @@
<p>
Returns the index of the least significant bit that is set to 1.
</p>
+<p>
+ Throws a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">range_error</span></code> if the argument is <= 0.
+ </p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span>
<span class="keyword">bool</span> <span class="identifier">bit_test</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">index</span><span class="special">);</span>
</pre>
@@ -1167,7 +1182,8 @@
Miller-Rabin tests. Returns <code class="computeroutput"><span class="keyword">false</span></code>
if <span class="emphasis"><em>n</em></span> is definitely composite, or <code class="computeroutput"><span class="keyword">true</span></code>
if <span class="emphasis"><em>n</em></span> is probably prime with the probability of it being
- composite less than 0.25^trials.
+ composite less than 0.25^trials. Fixed precision types are promoted internally
+ to ensure accuracy.
</p>
<h5>
<a name="boost_multiprecision.ref.number.h9"></a>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -51,7 +51,7 @@
</p>
<p>
Normally <code class="computeroutput"><span class="identifier">cpp_dec_float</span></code>
- allocates no memory: all of the space required for it's digits are allocated
+ allocates no memory: all of the space required for its digits are allocated
directly within the class. As a result care should be taken not to use
the class with too high a digit count as stack space requirements can grow
out of control. If that represents a problem then providing an allocator
@@ -59,7 +59,7 @@
to dynamically allocate the memory it needs: this significantly reduces
the size of <code class="computeroutput"><span class="identifier">cpp_dec_float</span></code>
and increases the viable upper limit on the number of digits at the expense
- of performance. However, please bare in mind that arithmetic operations
+ of performance. However, please bear in mind that arithmetic operations
rapidly become <span class="emphasis"><em>very</em></span> expensive as the digit count grows:
the current implementation really isn't optimized or designed for large
digit counts.
@@ -81,11 +81,6 @@
from base-2 types.
</li>
<li class="listitem">
- It is not possible to round-trip this type to and from a string and
- get back to exactly the same value (this is a result of the type having
- some hidden internal guard digits).
- </li>
-<li class="listitem">
The type has a number of internal guard digits over and above those
specified in the template argument. Normally these should not be visible
to the user.
Modified: sandbox/big_number/libs/multiprecision/doc/html/index.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/index.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/index.html 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -125,7 +125,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: November 03, 2012 at 18:24:27 GMT</small></p></td>
+<td align="left"><p><small>Last revised: November 12, 2012 at 19:14:07 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk (original)
+++ sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -80,6 +80,10 @@
unconstrained license. Which is to say some back-ends rely on 3rd party libraries, but a header-only Boost license version is always
available (if somewhat slower).
+Should you just wish to cut to the chase and use a fully Boost-licensed number type, then skip to
+__cpp_int for multiprecision integers, __cpp_dec_float for multiprecision floating point types
+and __cpp_rational for rational types.
+
The library is often used via one of the predefined typedefs: for example if you wanted an [@http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic arbitrary precision]
integer type using [gmp] as the underlying implementation then you could use:
@@ -625,12 +629,12 @@
which is more than large enough for the vast majority of use cases, but larger types such as `long long` can also be specified
if you need a truely huge exponent range.
-Normally `cpp_dec_float` allocates no memory: all of the space required for it's digits are allocated
+Normally `cpp_dec_float` allocates no memory: all of the space required for its digits are allocated
directly within the class. As a result care should be taken not to use the class with too high a digit count
as stack space requirements can grow out of control. If that represents a problem then providing an allocator
as the final template parameter causes `cpp_dec_float` to dynamically allocate the memory it needs: this
significantly reduces the size of `cpp_dec_float` and increases the viable upper limit on the number of digits
-at the expense of performance. However, please bare in mind that arithmetic operations rapidly become ['very] expensive
+at the expense of performance. However, please bear in mind that arithmetic operations rapidly become ['very] expensive
as the digit count grows: the current implementation really isn't optimized or designed for large digit counts.
There is full standard library and `numeric_limits` support available for this type.
@@ -639,8 +643,6 @@
* Default constructed `cpp_dec_float`s have a value of zero.
* The radix of this type is 10. As a result it can behave subtly differently from base-2 types.
-* It is not possible to round-trip this type to and from a string and get back to exactly the same value
-(this is a result of the type having some hidden internal guard digits).
* The type has a number of internal guard digits over and above those specified in the template argument.
Normally these should not be visible to the user.
* The type supports both infinities and NaN's. An infinity is generated whenever the result would overflow,
@@ -1864,14 +1866,22 @@
[h4 Integer functions]
+In addition to functioning with types from this library, these functions are also overloaded for built in integer
+types if you include `<boost/multiprecision/integer.hpp>`. Further, when used with fixed precision types (whether
+built in integers or multiprecision ones), the functions will promote to a wider type internally when the algorithm
+requires it. Versions overloaded for built in integer types return that integer type rather than an expression
+template.
+
``['unmentionable-expression-template-type]`` pow(const ``['number-or-expression-template-type]``& b, unsigned p);
Returns ['b[super p]] as an expression template. Note that this function should be used with extreme care as the result can grow so
-large as to take "effectively forever" to compute, or else simply run the host machine out of memory.
+large as to take "effectively forever" to compute, or else simply run the host machine out of memory. This is the one function in
+this category that is not overloaded for built in integer types, further, it's probably not a good idea to use it with
+fixed precision `cpp_int`'s either.
``['unmentionable-expression-template-type]`` powm(const ``['number-or-expression-template-type]``& b, const ``['number-or-expression-template-type]``& p, const ``['number-or-expression-template-type]``& m);
-Returns ['b[super p] mod m] as an expression template.
+Returns ['b[super p] mod m] as an expression template. Fixed precision types are promoted internally to ensure accuracy.
template <class Backend, expression_template_option ExpressionTemplates>
void divide_qr(const ``['number-or-expression-template-type]``& x, const ``['number-or-expression-template-type]``& y,
@@ -1917,7 +1927,8 @@
Tests to see if the number /n/ is probably prime - the test excludes the vast majority of composite numbers
by excluding small prime factors and performing a single Fermat test. Then performs /trials/ Miller-Rabin
tests. Returns `false` if /n/ is definitely composite, or `true` if /n/ is probably prime with the
-probability of it being composite less than 0.25^trials.
+probability of it being composite less than 0.25^trials. Fixed precision types are promoted internally
+to ensure accuracy.
[h4 Rational Number Functions]
@@ -3030,6 +3041,7 @@
* Added additional template parameter to `mpfr_float_backend` to allow stack-based allocation.
* Added section on mixed precision arithmetic, and added support for operations yielding a higher precision result
than either of the arguments.
+* Added overloads of integer-specific functions for built in integer types.
[h4 Pre-review history]
@@ -3061,15 +3073,15 @@
the hard part is IO and binary-decimal convertion.
* Should there be a choice of rounding mode (probably MPFR specific)?
* We can reuse temporaries in multiple subtrees (temporary caching).
+* cpp_dec_float should round to nearest.
+* A 2's complement fixed precision int that uses exactly N bits and no more.
Things requested in review:
-* A 2's complement fixed precision int that uses exactly N bits and no more.
* The performances of mp_number<a_trivial_adaptor<float>, false>respect to
float and mp_number<a_trivial_adaptor<int>, false> and int should be
given to show the cost of using the generic interface (Mostly done, just need to update docs to the latest results).
-* cpp_dec_float should round to nearest.
-* Should we provide min/max overloads for expression templates?
+* Should we provide min/max overloads for expression templates? (Not done - we can't overload functions declared in the std namespace :-( ).
* The rounding applied when converting must be documented (Done).
* Document why we don't abstract out addition/multiplication algorithms etc. (done - FAQ)
* Document why we don't use proto (compile times) (Done).
@@ -3158,7 +3170,7 @@
complement one favored by most native integer types. As a result the complement operator is deliberately disabled for
checked `cpp_int`'s. Unchecked `cpp_int`'s give the same valued result as a 2's complement type would, but not the same bit-pattern.]]
[[Why can't I negate an unsigned type?]
- [The unary negation operator is deliberately disabled for unsigned integer types as it's use would almost always be a programming error.]]
+ [The unary negation operator is deliberately disabled for unsigned integer types as its use would almost always be a programming error.]]
[[Why doesn't the library use proto?]
[A very early version of the library did use proto, but compile times became too slow
for the library to be usable. Since the library only required a tiny fraction of what
Modified: sandbox/big_number/libs/multiprecision/performance/Jamfile.v2
==============================================================================
--- sandbox/big_number/libs/multiprecision/performance/Jamfile.v2 (original)
+++ sandbox/big_number/libs/multiprecision/performance/Jamfile.v2 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -62,7 +62,9 @@
<define>TEST_CPP_INT
;
-exe sf_performance : sf_performance.cpp /boost/system//boost_system /boost/chrono//boost_chrono /boost/thread//boost_thread
+exe sf_performance : sf_performance.cpp sf_performance_basic.cpp sf_performance_bessel.cpp
+ sf_performance_nct.cpp sf_performance_poly.cpp
+ /boost/system//boost_system /boost/chrono//boost_chrono /boost/thread//boost_thread
: release
[ check-target-builds ../config//has_gmp : <define>TEST_MPF <define>TEST_MPZ <source>gmp : ]
[ check-target-builds ../config//has_mpfr : <define>TEST_MPFR <source>mpfr : ]
Modified: sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp (original)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -3,152 +3,7 @@
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
-#define BOOST_MATH_MAX_ROOT_ITERATION_POLICY 500
-#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
-
-#if !defined(TEST_MPFR) && !defined(TEST_MPREAL) && !defined(TEST_MPF) && !defined(TEST_MPREAL) \
- && !defined(TEST_CPP_DEC_FLOAT) && !defined(TEST_MPFR_CLASS) && !defined(TEST_FLOAT)
-# define TEST_MPFR
-# define TEST_MPF
-# define TEST_CPP_DEC_FLOAT
-# define TEST_MPFR_CLASS
-# define TEST_MPREAL
-# define TEST_FLOAT
-#endif
-
-#ifdef TEST_FLOAT
-#include "arithmetic_backend.hpp"
-#endif
-#ifdef TEST_MPFR_CLASS
-#include <boost/math/bindings/mpfr.hpp>
-#endif
-#ifdef TEST_MPFR
-#include <boost/multiprecision/mpfr.hpp>
-#endif
-#ifdef TEST_MPREAL
-#include <boost/math/bindings/mpreal.hpp>
-#endif
-#ifdef TEST_MPF
-#include <boost/multiprecision/gmp.hpp>
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
-#include <boost/multiprecision/cpp_dec_float.hpp>
-#endif
-#include <boost/math/special_functions/bessel.hpp>
-#include <boost/math/tools/rational.hpp>
-#include <boost/math/distributions/non_central_t.hpp>
-#include <libs/math/test/table_type.hpp>
-#include <boost/chrono.hpp>
-#include <boost/array.hpp>
-#include <boost/thread.hpp>
-
-template <class Real>
-Real test_bessel();
-
-template <class Clock>
-struct stopwatch
-{
- typedef typename Clock::duration duration;
- stopwatch()
- {
- m_start = Clock::now();
- }
- duration elapsed()
- {
- return Clock::now() - m_start;
- }
- void reset()
- {
- m_start = Clock::now();
- }
-
-private:
- typename Clock::time_point m_start;
-};
-
-template <class Real>
-Real test_bessel()
-{
- try{
-# define T double
-# define SC_(x) x
-# include "libs/math/test/bessel_i_int_data.ipp"
-# include "libs/math/test/bessel_i_data.ipp"
-
- Real r;
-
- for(unsigned i = 0; i < bessel_i_int_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_i(Real(bessel_i_int_data[i][0]), Real(bessel_i_int_data[i][1]));
- }
- for(unsigned i = 0; i < bessel_i_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_i(Real(bessel_i_data[i][0]), Real(bessel_i_data[i][1]));
- }
-
-#include "libs/math/test/bessel_j_int_data.ipp"
- for(unsigned i = 0; i < bessel_j_int_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_j(Real(bessel_j_int_data[i][0]), Real(bessel_j_int_data[i][1]));
- }
-
-#include "libs/math/test/bessel_j_data.ipp"
- for(unsigned i = 0; i < bessel_j_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_j(Real(bessel_j_data[i][0]), Real(bessel_j_data[i][1]));
- }
-
-#include "libs/math/test/bessel_j_large_data.ipp"
- for(unsigned i = 0; i < bessel_j_large_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_j(Real(bessel_j_large_data[i][0]), Real(bessel_j_large_data[i][1]));
- }
-
-#include "libs/math/test/sph_bessel_data.ipp"
- for(unsigned i = 0; i < sph_bessel_data.size(); ++i)
- {
- r += boost::math::sph_bessel(static_cast<unsigned>(sph_bessel_data[i][0]), Real(sph_bessel_data[i][1]));
- }
-
- return r;
- }
- catch(const std::exception& e)
- {
- std::cout << e.what() << std::endl;
- }
- return 0;
-}
-
-template <class Real>
-Real test_polynomial()
-{
- static const unsigned t[] = {
- 2, 3, 4, 5, 6, 7, 8 };
- Real result = 0;
- for(Real k = 2; k < 1000; ++k)
- result += boost::math::tools::evaluate_polynomial(t, k);
-
- return result;
-}
-
-template <class Real>
-Real test_nct()
-{
-#define T double
-#include "libs/math/test/nct.ipp"
-
- Real result = 0;
- for(unsigned i = 0; i < nct.size(); ++i)
- {
- try{
- result += quantile(boost::math::non_central_t_distribution<Real>(nct[i][0], nct[i][1]), nct[i][3]);
- }
- catch(const std::exception&)
- {}
- result += cdf(boost::math::non_central_t_distribution<Real>(nct[i][0], nct[i][1]), nct[i][2]);
- }
- return result;
-}
+#include "sf_performance.hpp"
unsigned allocation_count = 0;
@@ -173,273 +28,18 @@
return (*realloc_func_ptr)(p, old, n);
}
-template <class Real>
-void basic_allocation_test(const char* name, Real x)
-{
- static const unsigned a[] = { 2, 3, 4, 5, 6, 7, 8 };
- allocation_count = 0;
- Real result = (((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0];
- std::cout << "Allocation count for type " << name << " = " << allocation_count << std::endl;
-}
-
-template <class Real>
-void poly_allocation_test(const char* name, Real x)
-{
- static const unsigned a[] = { 2, 3, 4, 5, 6, 7, 8 };
- allocation_count = 0;
- Real result = boost::math::tools::evaluate_polynomial(a, x);
- std::cout << "Allocation count for type " << name << " = " << allocation_count << std::endl;
-}
-
-template <class Real>
-void time_proc(const char* name, Real (*proc)(), unsigned threads = 1)
-{
- try{
- static Real total = 0;
- allocation_count = 0;
- boost::chrono::duration<double> time;
- stopwatch<boost::chrono::high_resolution_clock> c;
- total += proc();
- time = c.elapsed();
- std::cout << "Time for " << name << " = " << time << std::endl;
- std::cout << "Total allocations for " << name << " = " << allocation_count << std::endl;
-
- for(unsigned thread_count = 1; thread_count < threads; ++thread_count)
- {
- c.reset();
- boost::thread_group g;
- for(unsigned i = 0; i <= thread_count; ++i)
- g.create_thread(proc);
- g.join_all();
- time = c.elapsed();
- std::cout << "Time for " << name << " (" << (thread_count + 1) << " threads) = " << time << std::endl;
- std::cout << "Total allocations for " << name << " = " << allocation_count << std::endl;
- }
- }
- catch(const std::exception& e)
- {
- std::cout << e.what() << std::endl;
- }
-}
-
int main()
{
using namespace boost::multiprecision;
+
#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS) || defined(TEST_MPREAL) || defined(TEST_MPF)
mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
mp_set_memory_functions(&alloc_func, &realloc_func, &free_func);
#endif
- std::cout << "Allocation Counts for Horner Evaluation:\n";
-#ifdef TEST_MPFR
- basic_allocation_test("mpfr_float_50", mpfr_float_50(2));
- basic_allocation_test("mpfr_float_50 - no expression templates", number<mpfr_float_backend<50>, et_off>(2));
-#endif
-#ifdef TEST_MPFR_CLASS
- basic_allocation_test("mpfr_class", mpfr_class(2));
-#endif
-#ifdef TEST_MPREAL
- basic_allocation_test("mpfr::mpreal", mpfr::mpreal(2));
-#endif
-
- std::cout << "Allocation Counts for boost::math::tools::evaluate_polynomial:\n";
-#ifdef TEST_MPFR
- poly_allocation_test("mpfr_float_50", mpfr_float_50(2));
- poly_allocation_test("mpfr_float_50 - no expression templates", number<mpfr_float_backend<50>, et_off>(2));
-#endif
-#ifdef TEST_MPFR_CLASS
- poly_allocation_test("mpfr_class", mpfr_class(2));
-#endif
-#ifdef TEST_MPREAL
- poly_allocation_test("mpfr::mpreal", mpfr::mpreal(2));
-#endif
-
- //
- // Comparison for builtin floats:
- //
-#ifdef TEST_FLOAT
- time_proc("Bessel Functions - double", test_bessel<double>);
- time_proc("Bessel Functions - real_concept", test_bessel<boost::math::concepts::real_concept>);
- time_proc("Bessel Functions - arithmetic_backend<double>", test_bessel<number<arithmetic_backend<double> > >);
- time_proc("Bessel Functions - arithmetic_backend<double> - no expression templates", test_bessel<number<arithmetic_backend<double>, et_off> >);
-
- time_proc("Non-central T - double", test_nct<double>);
- time_proc("Non-central T - real_concept", test_nct<boost::math::concepts::real_concept>);
- time_proc("Non-central T - arithmetic_backend<double>", test_nct<number<arithmetic_backend<double> > >);
- time_proc("Non-central T - arithmetic_backend<double> - no expression templates", test_nct<number<arithmetic_backend<double>, et_off> >);
-#endif
-
- //
- // 50 digits first:
- //
- std::cout << "Testing Bessel Functions at 50 digits....." << std::endl;
-#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
- mpfr_set_default_prec(50 * 1000L / 301L);
-#endif
-#ifdef TEST_MPREAL
- mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
-#endif
-#ifdef TEST_MPFR
-#if MPFR_VERSION<MPFR_VERSION_NUM(3,0,0)
- time_proc("mpfr_float_50", test_bessel<boost::multiprecision::mpfr_float_50>, 1);
- time_proc("mpfr_float_50 (no expression templates)", test_bessel<number<mpfr_float_backend<50>, et_off> >, 1);
- time_proc("static_mpfr_float_50", test_bessel<number<mpfr_float_backend<50, allocate_stack>, et_on> >, 1);
- time_proc("static_mpfr_float_50 (no expression templates)", test_bessel<number<mpfr_float_backend<50, allocate_stack>, et_off> >, 1);
-#else
- time_proc("mpfr_float_50", test_bessel<boost::multiprecision::mpfr_float_50>, mpfr_buildopt_tls_p() ? 3 : 1);
- time_proc("mpfr_float_50 (no expression templates", test_bessel<number<mpfr_float_backend<50>, et_off> >, mpfr_buildopt_tls_p() ? 3 : 1);
- time_proc("static_mpfr_float_50", test_bessel<number<mpfr_float_backend<50, allocate_stack>, et_on> >, mpfr_buildopt_tls_p() ? 3 : 1);
- time_proc("static_mpfr_float_50 (no expression templates)", test_bessel<number<mpfr_float_backend<50, allocate_stack>, et_off> >, mpfr_buildopt_tls_p() ? 3 : 1);
-#endif
-#endif
-#ifdef TEST_MPF
- time_proc("mpf_float_50", test_bessel<mpf_float_50>, 3);
- time_proc("mpf_float_50 (no expression templates", test_bessel<number<gmp_float<50>, et_off> >, 3);
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
- time_proc("cpp_dec_float_50", test_bessel<cpp_dec_float_50>, 3);
-#endif
-#ifdef TEST_MPFR_CLASS
- time_proc("mpfr_class", test_bessel<mpfr_class>, mpfr_buildopt_tls_p() ? 3 : 1);
-#endif
-#ifdef TEST_MPREAL
- time_proc("mpfr::mpreal", test_bessel<mpfr::mpreal>, mpfr_buildopt_tls_p() ? 3 : 1);
-#endif
- //
- // Then 100 digits:
- //
- std::cout << "Testing Bessel Functions at 100 digits....." << std::endl;
-#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
- mpfr_set_default_prec(100 * 1000L / 301L);
-#endif
-#ifdef TEST_MPREAL
- mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
-#endif
-#ifdef TEST_MPFR
- time_proc("mpfr_float_100", test_bessel<mpfr_float_100>);
- time_proc("mpfr_float_100 (no expression templates", test_bessel<number<mpfr_float_backend<100>, et_off> >);
-#endif
-#ifdef TEST_MPF
- time_proc("mpf_float_100", test_bessel<mpf_float_100>);
- time_proc("mpf_float_100 (no expression templates", test_bessel<number<gmp_float<100>, et_off> >);
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
- time_proc("cpp_dec_float_100", test_bessel<cpp_dec_float_100>);
-#endif
-#ifdef TEST_MPFR_CLASS
- time_proc("mpfr_class", test_bessel<mpfr_class>);
-#endif
-#ifdef TEST_MPREAL
- time_proc("mpfr::mpreal", test_bessel<mpfr::mpreal>);
-#endif
-
- //
- // 50 digits first:
- //
- std::cout << "Testing Polynomial Evaluation at 50 digits....." << std::endl;
-#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
- mpfr_set_default_prec(50 * 1000L / 301L);
-#endif
-#ifdef TEST_MPREAL
- mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
-#endif
-#ifdef TEST_MPFR
- time_proc("mpfr_float_50", test_polynomial<mpfr_float_50>);
- time_proc("mpfr_float_50 (no expression templates", test_polynomial<number<mpfr_float_backend<50>, et_off> >);
-#endif
-#ifdef TEST_MPF
- time_proc("mpf_float_50", test_polynomial<mpf_float_50>);
- time_proc("mpf_float_50 (no expression templates", test_polynomial<number<gmp_float<50>, et_off> >);
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
- time_proc("cpp_dec_float_50", test_polynomial<cpp_dec_float_50>);
-#endif
-#ifdef TEST_MPFR_CLASS
- time_proc("mpfr_class", test_polynomial<mpfr_class>);
-#endif
-#ifdef TEST_MPREAL
- time_proc("mpfr::mpreal", test_polynomial<mpfr::mpreal>);
-#endif
- //
- // Then 100 digits:
- //
- std::cout << "Testing Polynomial Evaluation at 100 digits....." << std::endl;
-#ifdef TEST_MPFR_CLASS
- mpfr_set_default_prec(100 * 1000L / 301L);
-#endif
-#ifdef TEST_MPREAL
- mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
-#endif
-#ifdef TEST_MPFR
- time_proc("mpfr_float_100", test_polynomial<mpfr_float_100>);
- time_proc("mpfr_float_100 (no expression templates", test_polynomial<number<mpfr_float_backend<100>, et_off> >);
-#endif
-#ifdef TEST_MPF
- time_proc("mpf_float_100", test_polynomial<mpf_float_100>);
- time_proc("mpf_float_100 (no expression templates", test_polynomial<number<gmp_float<100>, et_off> >);
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
- time_proc("cpp_dec_float_100", test_polynomial<cpp_dec_float_100>);
-#endif
-#ifdef TEST_MPFR_CLASS
- time_proc("mpfr_class", test_polynomial<mpfr_class>);
-#endif
-#ifdef TEST_MPREAL
- time_proc("mpfr::mpreal", test_polynomial<mpfr::mpreal>);
-#endif
- //
- // 50 digits first:
- //
- std::cout << "Testing Non-Central T at 50 digits....." << std::endl;
-#ifdef TEST_MPFR_CLASS
- mpfr_set_default_prec(50 * 1000L / 301L);
-#endif
-#ifdef TEST_MPREAL
- mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
-#endif
-#ifdef TEST_MPFR
- time_proc("mpfr_float_50", test_nct<mpfr_float_50>);
- time_proc("mpfr_float_50 (no expression templates", test_nct<number<mpfr_float_backend<50>, et_off> >);
-#endif
-#ifdef TEST_MPF
- time_proc("mpf_float_50", test_nct<mpf_float_50>);
- time_proc("mpf_float_50 (no expression templates", test_nct<number<gmp_float<50>, et_off> >);
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
- time_proc("cpp_dec_float_50", test_nct<cpp_dec_float_50>);
-#endif
-#ifdef TEST_MPFR_CLASS
- time_proc("mpfr_class", test_nct<mpfr_class>);
-#endif
-#ifdef TEST_MPREAL
- time_proc("mpfr::mpreal", test_nct<mpfr::mpreal>);
-#endif
- //
- // Then 100 digits:
- //
- std::cout << "Testing Non-Central T at 100 digits....." << std::endl;
-#ifdef TEST_MPFR_CLASS
- mpfr_set_default_prec(100 * 1000L / 301L);
-#endif
-#ifdef TEST_MPREAL
- mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
-#endif
-#ifdef TEST_MPFR
- time_proc("mpfr_float_100", test_nct<mpfr_float_100>);
- time_proc("mpfr_float_100 (no expression templates", test_nct<number<mpfr_float_backend<100>, et_off> >);
-#endif
-#ifdef TEST_MPF
- time_proc("mpf_float_100", test_nct<mpf_float_100>);
- time_proc("mpf_float_100 (no expression templates", test_nct<number<gmp_float<100>, et_off> >);
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
- time_proc("cpp_dec_float_100", test_nct<cpp_dec_float_100>);
-#endif
-#ifdef TEST_MPFR_CLASS
- time_proc("mpfr_class", test_nct<mpfr_class>);
-#endif
-#ifdef TEST_MPREAL
- time_proc("mpfr::mpreal", test_nct<mpfr::mpreal>);
-#endif
+ basic_tests();
+ bessel_tests();
+ poly_tests();
+ nct_tests();
}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_basic.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_basic.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,49 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void basic_tests()
+{
+
+ std::cout << "Allocation Counts for Horner Evaluation:\n";
+#ifdef TEST_MPFR
+ basic_allocation_test("mpfr_float_50", mpfr_float_50(2));
+ basic_allocation_test("mpfr_float_50 - no expression templates", number<mpfr_float_backend<50>, et_off>(2));
+#endif
+#ifdef TEST_MPFR_CLASS
+ basic_allocation_test("mpfr_class", mpfr_class(2));
+#endif
+#ifdef TEST_MPREAL
+ basic_allocation_test("mpfr::mpreal", mpfr::mpreal(2));
+#endif
+
+ std::cout << "Allocation Counts for boost::math::tools::evaluate_polynomial:\n";
+#ifdef TEST_MPFR
+ poly_allocation_test("mpfr_float_50", mpfr_float_50(2));
+ poly_allocation_test("mpfr_float_50 - no expression templates", number<mpfr_float_backend<50>, et_off>(2));
+#endif
+#ifdef TEST_MPFR_CLASS
+ poly_allocation_test("mpfr_class", mpfr_class(2));
+#endif
+#ifdef TEST_MPREAL
+ poly_allocation_test("mpfr::mpreal", mpfr::mpreal(2));
+#endif
+
+ //
+ // Comparison for builtin floats:
+ //
+#ifdef TEST_FLOAT
+ time_proc("Bessel Functions - double", test_bessel<double>);
+ time_proc("Bessel Functions - real_concept", test_bessel<boost::math::concepts::real_concept>);
+ time_proc("Bessel Functions - arithmetic_backend<double>", test_bessel<number<arithmetic_backend<double> > >);
+ time_proc("Bessel Functions - arithmetic_backend<double> - no expression templates", test_bessel<number<arithmetic_backend<double>, et_off> >);
+
+ time_proc("Non-central T - double", test_nct<double>);
+ time_proc("Non-central T - real_concept", test_nct<boost::math::concepts::real_concept>);
+ time_proc("Non-central T - arithmetic_backend<double>", test_nct<number<arithmetic_backend<double> > >);
+ time_proc("Non-central T - arithmetic_backend<double> - no expression templates", test_nct<number<arithmetic_backend<double>, et_off> >);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,42 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void bessel_tests_1();
+void bessel_tests_2();
+void bessel_tests_3();
+void bessel_tests_4();
+void bessel_tests_5();
+void bessel_tests_6();
+
+void bessel_tests()
+{
+ //
+ // 50 digits first:
+ //
+ std::cout << "Testing Bessel Functions at 50 digits....." << std::endl;
+#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
+ mpfr_set_default_prec(50 * 1000L / 301L);
+#endif
+#ifdef TEST_MPREAL
+ mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
+#endif
+
+ bessel_tests_1();
+ bessel_tests_2();
+ bessel_tests_3();
+
+ //
+ // Then 100 digits:
+ //
+ std::cout << "Testing Bessel Functions at 100 digits....." << std::endl;
+#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
+ mpfr_set_default_prec(100 * 1000L / 301L);
+#endif
+ bessel_tests_4();
+ bessel_tests_5();
+ bessel_tests_6();
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel1.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel1.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void bessel_tests_1()
+{
+#ifdef TEST_MPFR
+#if MPFR_VERSION<MPFR_VERSION_NUM(3,0,0)
+ time_proc("mpfr_float_50", test_bessel<boost::multiprecision::mpfr_float_50>, 1);
+ time_proc("mpfr_float_50 (no expression templates)", test_bessel<number<mpfr_float_backend<50>, et_off> >, 1);
+ time_proc("static_mpfr_float_50", test_bessel<number<mpfr_float_backend<50, allocate_stack>, et_on> >, 1);
+ time_proc("static_mpfr_float_50 (no expression templates)", test_bessel<number<mpfr_float_backend<50, allocate_stack>, et_off> >, 1);
+#else
+ time_proc("mpfr_float_50", test_bessel<boost::multiprecision::mpfr_float_50>, mpfr_buildopt_tls_p() ? 3 : 1);
+ time_proc("mpfr_float_50 (no expression templates", test_bessel<number<mpfr_float_backend<50>, et_off> >, mpfr_buildopt_tls_p() ? 3 : 1);
+ time_proc("static_mpfr_float_50", test_bessel<number<mpfr_float_backend<50, allocate_stack>, et_on> >, mpfr_buildopt_tls_p() ? 3 : 1);
+ time_proc("static_mpfr_float_50 (no expression templates)", test_bessel<number<mpfr_float_backend<50, allocate_stack>, et_off> >, mpfr_buildopt_tls_p() ? 3 : 1);
+#endif
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel2.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel2.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,17 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void bessel_tests_2()
+{
+#ifdef TEST_MPF
+ time_proc("mpf_float_50", test_bessel<mpf_float_50>, 3);
+ time_proc("mpf_float_50 (no expression templates", test_bessel<number<gmp_float<50>, et_off> >, 3);
+#endif
+#ifdef TEST_CPP_DEC_FLOAT
+ time_proc("cpp_dec_float_50", test_bessel<cpp_dec_float_50>, 3);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel3.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel3.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void bessel_tests_3()
+{
+#ifdef TEST_MPFR_CLASS
+ time_proc("mpfr_class", test_bessel<mpfr_class>, mpfr_buildopt_tls_p() ? 3 : 1);
+#endif
+#ifdef TEST_MPREAL
+ time_proc("mpfr::mpreal", test_bessel<mpfr::mpreal>, mpfr_buildopt_tls_p() ? 3 : 1);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel4.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel4.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,15 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void bessel_tests_4()
+{
+#ifdef TEST_MPFR
+ time_proc("mpfr_float_100", test_bessel<mpfr_float_100>);
+ time_proc("mpfr_float_100 (no expression templates", test_bessel<number<mpfr_float_backend<100>, et_off> >);
+ time_proc("static_mpfr_float_100", test_bessel<static_mpfr_float_100>);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel5.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel5.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,17 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void bessel_tests_5()
+{
+#ifdef TEST_MPREAL
+ mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
+#endif
+#ifdef TEST_MPF
+ time_proc("mpf_float_100", test_bessel<mpf_float_100>);
+ time_proc("mpf_float_100 (no expression templates", test_bessel<number<gmp_float<100>, et_off> >);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel6.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_bessel6.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,19 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void bessel_tests_6()
+{
+#ifdef TEST_CPP_DEC_FLOAT
+ time_proc("cpp_dec_float_100", test_bessel<cpp_dec_float_100>);
+#endif
+#ifdef TEST_MPFR_CLASS
+ time_proc("mpfr_class", test_bessel<mpfr_class>);
+#endif
+#ifdef TEST_MPREAL
+ time_proc("mpfr::mpreal", test_bessel<mpfr::mpreal>);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_nct.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_nct.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void nct_tests_1();
+void nct_tests_2();
+void nct_tests_3();
+void nct_tests_4();
+void nct_tests_5();
+void nct_tests_6();
+
+void nct_tests()
+{
+ //
+ // 50 digits first:
+ //
+ std::cout << "Testing Non-Central T at 50 digits....." << std::endl;
+#ifdef TEST_MPFR_CLASS
+ mpfr_set_default_prec(50 * 1000L / 301L);
+#endif
+
+ nct_tests_1();
+ nct_tests_2();
+ nct_tests_3();
+
+ //
+ // Then 100 digits:
+ //
+ std::cout << "Testing Non-Central T at 100 digits....." << std::endl;
+#ifdef TEST_MPFR_CLASS
+ mpfr_set_default_prec(100 * 1000L / 301L);
+#endif
+ nct_tests_4();
+ nct_tests_5();
+ nct_tests_6();
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_nct1.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_nct1.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,15 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void nct_tests_1()
+{
+#ifdef TEST_MPFR
+ time_proc("mpfr_float_50", test_nct<mpfr_float_50>);
+ time_proc("mpfr_float_50 (no expression templates", test_nct<number<mpfr_float_backend<50>, et_off> >);
+ time_proc("static_mpfr_float_50", test_nct<static_mpfr_float_50>);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_nct2.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_nct2.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void nct_tests_2()
+{
+#ifdef TEST_MPF
+ time_proc("mpf_float_50", test_nct<mpf_float_50>);
+ time_proc("mpf_float_50 (no expression templates", test_nct<number<gmp_float<50>, et_off> >);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_nct3.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_nct3.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void nct_tests_3()
+{
+#ifdef TEST_MPREAL
+ mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
+#endif
+#ifdef TEST_CPP_DEC_FLOAT
+ time_proc("cpp_dec_float_50", test_nct<cpp_dec_float_50>);
+#endif
+#ifdef TEST_MPFR_CLASS
+ time_proc("mpfr_class", test_nct<mpfr_class>);
+#endif
+#ifdef TEST_MPREAL
+ time_proc("mpfr::mpreal", test_nct<mpfr::mpreal>);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_nct4.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_nct4.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,15 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void nct_tests_4()
+{
+#ifdef TEST_MPFR
+ time_proc("mpfr_float_100", test_nct<mpfr_float_100>);
+ time_proc("mpfr_float_100 (no expression templates", test_nct<number<mpfr_float_backend<100>, et_off> >);
+ time_proc("static_mpfr_float_100", test_nct<static_mpfr_float_100>);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_nct5.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_nct5.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void nct_tests_5()
+{
+#ifdef TEST_MPF
+ time_proc("mpf_float_100", test_nct<mpf_float_100>);
+ time_proc("mpf_float_100 (no expression templates", test_nct<number<gmp_float<100>, et_off> >);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_nct6.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_nct6.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void nct_tests_6()
+{
+#ifdef TEST_MPREAL
+ mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
+#endif
+#ifdef TEST_CPP_DEC_FLOAT
+ time_proc("cpp_dec_float_100", test_nct<cpp_dec_float_100>);
+#endif
+#ifdef TEST_MPFR_CLASS
+ time_proc("mpfr_class", test_nct<mpfr_class>);
+#endif
+#ifdef TEST_MPREAL
+ time_proc("mpfr::mpreal", test_nct<mpfr::mpreal>);
+#endif
+}
Added: sandbox/big_number/libs/multiprecision/performance/sf_performance_poly.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance_poly.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -0,0 +1,66 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2011 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include "sf_performance.hpp"
+
+void poly_tests()
+{
+ //
+ // 50 digits first:
+ //
+ std::cout << "Testing Polynomial Evaluation at 50 digits....." << std::endl;
+#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
+ mpfr_set_default_prec(50 * 1000L / 301L);
+#endif
+#ifdef TEST_MPREAL
+ mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
+#endif
+#ifdef TEST_MPFR
+ time_proc("mpfr_float_50", test_polynomial<mpfr_float_50>);
+ time_proc("mpfr_float_50 (no expression templates", test_polynomial<number<mpfr_float_backend<50>, et_off> >);
+ time_proc("static_mpfr_float_50", test_polynomial<static_mpfr_float_50>);
+#endif
+#ifdef TEST_MPF
+ time_proc("mpf_float_50", test_polynomial<mpf_float_50>);
+ time_proc("mpf_float_50 (no expression templates", test_polynomial<number<gmp_float<50>, et_off> >);
+#endif
+#ifdef TEST_CPP_DEC_FLOAT
+ time_proc("cpp_dec_float_50", test_polynomial<cpp_dec_float_50>);
+#endif
+#ifdef TEST_MPFR_CLASS
+ time_proc("mpfr_class", test_polynomial<mpfr_class>);
+#endif
+#ifdef TEST_MPREAL
+ time_proc("mpfr::mpreal", test_polynomial<mpfr::mpreal>);
+#endif
+ //
+ // Then 100 digits:
+ //
+ std::cout << "Testing Polynomial Evaluation at 100 digits....." << std::endl;
+#ifdef TEST_MPFR_CLASS
+ mpfr_set_default_prec(100 * 1000L / 301L);
+#endif
+#ifdef TEST_MPREAL
+ mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
+#endif
+#ifdef TEST_MPFR
+ time_proc("mpfr_float_100", test_polynomial<mpfr_float_100>);
+ time_proc("mpfr_float_100 (no expression templates", test_polynomial<number<mpfr_float_backend<100>, et_off> >);
+ time_proc("static_mpfr_float_100", test_polynomial<static_mpfr_float_100>);
+#endif
+#ifdef TEST_MPF
+ time_proc("mpf_float_100", test_polynomial<mpf_float_100>);
+ time_proc("mpf_float_100 (no expression templates", test_polynomial<number<gmp_float<100>, et_off> >);
+#endif
+#ifdef TEST_CPP_DEC_FLOAT
+ time_proc("cpp_dec_float_100", test_polynomial<cpp_dec_float_100>);
+#endif
+#ifdef TEST_MPFR_CLASS
+ time_proc("mpfr_class", test_polynomial<mpfr_class>);
+#endif
+#ifdef TEST_MPREAL
+ time_proc("mpfr::mpreal", test_polynomial<mpfr::mpreal>);
+#endif
+}
Modified: sandbox/big_number/libs/multiprecision/test/test_atan.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_atan.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_atan.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -44,6 +44,10 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
template <class T>
T atan2_def(T y, T x)
{
Modified: sandbox/big_number/libs/multiprecision/test/test_float_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_float_io.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_float_io.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -40,6 +40,10 @@
#include <iostream>
#include <iomanip>
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
#if defined(TEST_MPF_50)
template <unsigned N, boost::multiprecision::expression_template_option ET>
bool is_mpf(const boost::multiprecision::number<boost::multiprecision::gmp_float<N>, ET>&)
@@ -286,12 +290,10 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
-
// cpp_dec_float has extra guard digits that messes this up:
test_round_trip<boost::multiprecision::cpp_dec_float_50>();
test_round_trip<boost::multiprecision::cpp_dec_float_100>();
-
#endif
#ifdef TEST_MPF_50
test<boost::multiprecision::mpf_float_50>();
Modified: sandbox/big_number/libs/multiprecision/test/test_int_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_int_io.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_int_io.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -40,6 +40,10 @@
#include <iostream>
#include <iomanip>
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
template <class T>
struct unchecked_type{ typedef T type; };
Modified: sandbox/big_number/libs/multiprecision/test/test_native_integer.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_native_integer.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_native_integer.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -38,7 +38,7 @@
if(std::numeric_limits<I>::is_signed)
{
- i = -1;
+ i = static_cast<I>(-1);
BOOST_CHECK_THROW(lsb(i), std::range_error);
}
Modified: sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -51,6 +51,10 @@
#include <boost/multiprecision/cpp_int.hpp>
#endif
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
#define PRINT(x)\
std::cout << BOOST_STRINGIZE(x) << " = " << std::numeric_limits<Number>::x << std::endl;
Modified: sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -36,7 +36,6 @@
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int.hpp>
-#include <boost/rational.hpp>
#include <boost/multiprecision/rational_adapter.hpp>
#include "test.hpp"
#include <iostream>
Modified: sandbox/big_number/libs/multiprecision/test/test_round.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_round.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_round.cpp 2012-11-13 12:12:19 EST (Tue, 13 Nov 2012)
@@ -43,6 +43,10 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
boost::mt19937 rng;
template <class 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