|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77948 - in sandbox/big_number/libs/multiprecision: doc doc/html example test
From: john_at_[hidden]
Date: 2012-04-13 11:38:31
Author: johnmaddock
Date: 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
New Revision: 77948
URL: http://svn.boost.org/trac/boost/changeset/77948
Log:
Update examples, reorganise docs, temporarily remove HTML before rebuilding.
Enhance test cases, including enabling loopback testing on cpp_dec_float io.
Added:
sandbox/big_number/libs/multiprecision/doc/floating_point_eg1.mml (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/floating_point_eg1.png (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/floating_point_eg1.svg (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/floating_point_eg2.mml (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/floating_point_eg2.png (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/floating_point_eg2.svg (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/floating_point_eg3.mml (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/floating_point_eg3.png (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/floating_point_eg3.svg (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/generate.sh (contents, props changed)
sandbox/big_number/libs/multiprecision/example/integer_examples.cpp (contents, props changed)
Removed:
sandbox/big_number/libs/multiprecision/doc/html/
Text files modified:
sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk | 28 ++++++++
sandbox/big_number/libs/multiprecision/example/floating_point_examples.cpp | 121 ++++++++++++++++++++++++++++++++++++++++
sandbox/big_number/libs/multiprecision/test/test_acos.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp | 15 ++++
sandbox/big_number/libs/multiprecision/test/test_asin.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_atan.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_cos.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_cosh.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_exp.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_float_io.cpp | 8 +-
sandbox/big_number/libs/multiprecision/test/test_log.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_pow.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_round.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_sin.cpp | 10 +++
sandbox/big_number/libs/multiprecision/test/test_sinh.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_sqrt.cpp | 9 ++
sandbox/big_number/libs/multiprecision/test/test_tanh.cpp | 9 ++
17 files changed, 282 insertions(+), 8 deletions(-)
Added: sandbox/big_number/libs/multiprecision/doc/floating_point_eg1.mml
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/floating_point_eg1.mml 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -0,0 +1,154 @@
+<?xml version='1.0'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN'
+ 'http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd'
+ [<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head><title>floating_point_eg1</title>
+<!-- MathML created with MathCast Equation Editor version 0.89 -->
+</head>
+<body>
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+ <mrow>
+ <mfenced>
+ <mrow>
+ <mn>1</mn>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mspace width="1em"/>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mi>f</mi>
+ <mo>′</mo>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ </mtd>
+ <mtd>
+ <mo>≈</mo>
+ </mtd>
+ <mtd>
+ <msub>
+ <mi>m</mi>
+ <mn>1</mn>
+ </msub>
+ <mo>+</mo>
+ <mi>O</mi>
+ <mfenced>
+ <mrow>
+ <mi>d</mi>
+ <msup>
+ <mi>x</mi>
+ <mn>2</mn>
+ </msup>
+ </mrow>
+ </mfenced>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mi>f</mi>
+ <mo>′</mo>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ </mtd>
+ <mtd>
+ <mo>≈</mo>
+ </mtd>
+ <mtd>
+ <mfrac>
+ <mn>4</mn>
+ <mn>3</mn>
+ </mfrac>
+ <msub>
+ <mi>m</mi>
+ <mn>1</mn>
+ </msub>
+ <mo>−</mo>
+ <mfrac>
+ <mn>1</mn>
+ <mn>3</mn>
+ </mfrac>
+ <msub>
+ <mi>m</mi>
+ <mn>2</mn>
+ </msub>
+ <mo>+</mo>
+ <mi>O</mi>
+ <mfenced>
+ <mrow>
+ <mi>d</mi>
+ <msup>
+ <mi>x</mi>
+ <mn>4</mn>
+ </msup>
+ </mrow>
+ </mfenced>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mi>f</mi>
+ <mo>′</mo>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ </mtd>
+ <mtd>
+ <mo>≈</mo>
+ </mtd>
+ <mtd>
+ <mfrac>
+ <mn>3</mn>
+ <mn>2</mn>
+ </mfrac>
+ <msub>
+ <mi>m</mi>
+ <mn>1</mn>
+ </msub>
+ <mo>−</mo>
+ <mfrac>
+ <mn>3</mn>
+ <mn>5</mn>
+ </mfrac>
+ <msub>
+ <mi>m</mi>
+ <mn>2</mn>
+ </msub>
+ <mo>+</mo>
+ <mfrac>
+ <mn>1</mn>
+ <mn>10</mn>
+ </mfrac>
+ <msub>
+ <mi>m</mi>
+ <mn>3</mn>
+ </msub>
+ <mo>+</mo>
+ <mi>O</mi>
+ <mfenced>
+ <mrow>
+ <mi>d</mi>
+ <msup>
+ <mi>x</mi>
+ <mn>6</mn>
+ </msup>
+ </mrow>
+ </mfenced>
+ </mtd>
+ </mtr>
+ </mtable>
+ </mrow>
+</math>
+</body>
+</html>
+
+
Added: sandbox/big_number/libs/multiprecision/doc/floating_point_eg1.png
==============================================================================
Binary file. No diff available.
Added: sandbox/big_number/libs/multiprecision/doc/floating_point_eg1.svg
==============================================================================
Binary file. No diff available.
Added: sandbox/big_number/libs/multiprecision/doc/floating_point_eg2.mml
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/floating_point_eg2.mml 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -0,0 +1,152 @@
+<?xml version='1.0'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN'
+ 'http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd'
+ [<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head><title>floating_point_eg2</title>
+<!-- MathML created with MathCast Equation Editor version 0.89 -->
+</head>
+<body>
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+ <mrow>
+ <mfenced>
+ <mrow>
+ <mn>2</mn>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mspace width="1em"/>
+ <mtable>
+ <mtr>
+ <mtd>
+ <msub>
+ <mi>m</mi>
+ <mn>1</mn>
+ </msub>
+ </mtd>
+ <mtd>
+ <mo>=</mo>
+ </mtd>
+ <mtd>
+ <mfrac>
+ <mrow>
+ <mi>f</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>+</mo>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ <mo>−</mo>
+ <mi>f</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>−</mo>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ </mrow>
+ <mrow>
+ <mn>2</mn>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfrac>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <msub>
+ <mi>m</mi>
+ <mn>2</mn>
+ </msub>
+ </mtd>
+ <mtd>
+ <mo>=</mo>
+ </mtd>
+ <mtd>
+ <mfrac>
+ <mrow>
+ <mi>f</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>+</mo>
+ <mn>2</mn>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ <mo>−</mo>
+ <mi>f</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>−</mo>
+ <mn>2</mn>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ </mrow>
+ <mrow>
+ <mn>4</mn>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfrac>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <msub>
+ <mi>m</mi>
+ <mn>3</mn>
+ </msub>
+ </mtd>
+ <mtd>
+ <mo>=</mo>
+ </mtd>
+ <mtd>
+ <mfrac>
+ <mrow>
+ <mi>f</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>+</mo>
+ <mn>3</mn>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ <mo>−</mo>
+ <mi>f</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>−</mo>
+ <mn>3</mn>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ </mrow>
+ <mrow>
+ <mn>6</mn>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfrac>
+ </mtd>
+ </mtr>
+ </mtable>
+ </mrow>
+</math>
+</body>
+</html>
+
Added: sandbox/big_number/libs/multiprecision/doc/floating_point_eg2.png
==============================================================================
Binary file. No diff available.
Added: sandbox/big_number/libs/multiprecision/doc/floating_point_eg2.svg
==============================================================================
Binary file. No diff available.
Added: sandbox/big_number/libs/multiprecision/doc/floating_point_eg3.mml
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/floating_point_eg3.mml 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -0,0 +1,53 @@
+<?xml version='1.0'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN'
+ 'http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd'
+ [<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head><title>floating_point_eg3</title>
+<!-- MathML created with MathCast Equation Editor version 0.89 -->
+</head>
+<body>
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+ <mrow>
+ <mfenced>
+ <mrow>
+ <mn>3</mn>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mspace width="1em"/>
+ <mfrac>
+ <mi>d</mi>
+ <mrow>
+ <mi>d</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfrac>
+ <mi>sin</mi>
+ <mi>x</mi>
+ <msub>
+ <mo>|</mo>
+ <mrow>
+ <mi>x</mi>
+ <mo>=</mo>
+ <mfrac>
+ <mi>π</mi>
+ <mn>3</mn>
+ </mfrac>
+ </mrow>
+ </msub>
+ <mo>=</mo>
+ <mi>cos</mi>
+ <mfrac>
+ <mi>π</mi>
+ <mn>3</mn>
+ </mfrac>
+ <mo>=</mo>
+ <mfrac>
+ <mn>1</mn>
+ <mn>2</mn>
+ </mfrac>
+ </mrow>
+</math>
+</body>
+</html>
Added: sandbox/big_number/libs/multiprecision/doc/floating_point_eg3.png
==============================================================================
Binary file. No diff available.
Added: sandbox/big_number/libs/multiprecision/doc/floating_point_eg3.svg
==============================================================================
Binary file. No diff available.
Added: sandbox/big_number/libs/multiprecision/doc/generate.sh
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/generate.sh 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -0,0 +1,33 @@
+# 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)
+#
+# Generates SVG and PNG files from the MML masters.
+#
+# Paths to tools come first, change these to match your system:
+#
+math2svg='m:\download\open\SVGMath-0.3.1\math2svg.py'
+python=/cygdrive/c/Python26/python.exe
+inkscape=/cygdrive/c/progra~1/Inkscape/inkscape
+# Image DPI:
+dpi=120
+
+for mmlfile in $*; do
+ svgfile=$(basename $mmlfile .mml).svg
+ pngfile=$(basename $svgfile .svg).png
+ tempfile=temp.mml
+ # strip html wrappers put in by MathCast:
+ cat $mmlfile | tr -d "\r\n" | sed -e 's/.*\(<math[^>]*>.*<\/math>\).*/\1/' > $tempfile
+
+ echo Generating $svgfile
+ $python $math2svg $tempfile > $svgfile
+ echo Generating $pngfile
+ $inkscape -d $dpi -e $(cygpath -a -w $pngfile) $(cygpath -a -w $svgfile)
+ rm $tempfile
+done
+
+
+
+
+
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-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -407,6 +407,20 @@
[endsect]
+[section:egs Examples]
+
+[import ../example/integer_examples.cpp]
+
+[section:factorials Factorials]
+[FAC1]
+[endsect]
+
+[section:bitops Bit Operations]
+[BITOPS]
+[endsect]
+
+[endsect]
+
[endsect]
[section:floats Floating Point Numbers]
@@ -595,13 +609,19 @@
[endsect]
-[section:GI Calculating an Integral]
+[section:gi Calculating an Integral]
[GI1]
[GI2]
[endsect]
+[section:poly_eg Polynomial Evaluation]
+
+[POLY]
+
+[endsect]
+
[endsect]
[endsect]
@@ -874,7 +894,7 @@
[section:primetest Primality Testing]
-The library implements a fairly basic (meaning unoptimized, and possibly slow) Miller-Rabin test for primality:
+The library implements a Miller-Rabin test for primality:
#include <boost/multiprecision/miller_rabin.hpp>
@@ -885,7 +905,9 @@
bool miller_rabin_test(const mp_number<Backend, ExpressionTemplates>& n, unsigned trials);
These functions perform a Miller-Rabin test for primality, if the result is `false` then /n/ is definitely composite,
-while if the result is `true` then /n/ is prime with probability ['0.25^trials]. The algorithm used is straight out of
+while if the result is `true` then /n/ is prime with probability ['0.25^trials]. The algorithm used performs some
+trial divisions to exclude small prime factors, does one Fermat test to exclude many more composites, and then
+uses the Miller-Rabin algorithm straight out of
Knuth Vol 2, which recomends 25 trials for a pretty strong likelyhood that /n/ is prime.
The third optional argument is for a Uniform Random Number Generator from Boost.Random. When not provided the `mt19937`
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-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -8,6 +8,7 @@
#include <boost/math/special_functions/bessel.hpp>
#include <iostream>
#include <iomanip>
+#include <array>
//[AOS1
@@ -338,6 +339,120 @@
//]
+//[POLY
+
+/*`
+In this example we'll look at polynomial evaluation, this is not only an important
+use case, but it's one that `mp_number` performs particularly well at because the
+expression templates ['completely eliminate all temporaries] from a
+[@http://en.wikipedia.org/wiki/Horner%27s_method Horner polynomial
+evaluation scheme].
+
+The following code evaluates `sin(x)` as a polynomial, accurate to at least 64 decimal places:
+
+*/
+
+using boost::multiprecision::cpp_dec_float;
+typedef boost::multiprecision::mp_number<cpp_dec_float<64> > mp_type;
+
+mp_type mysin(const mp_type& x)
+{
+ // Approximation of sin(x * pi/2) for -1 <= x <= 1, using an order 63 polynomial.
+ static const std::array<mp_type, 32U> coefs =
+ {{
+ mp_type("+1.5707963267948966192313216916397514420985846996875529104874722961539082031431044993140174126711"), //"),
+ mp_type("-0.64596409750624625365575656389794573337969351178927307696134454382929989411386887578263960484"), // ^3
+ mp_type("+0.07969262624616704512050554949047802252091164235106119545663865720995702920146198554317279"), // ^5
+ mp_type("-0.0046817541353186881006854639339534378594950280185010575749538605102665157913157426229824"), // ^7
+ mp_type("+0.00016044118478735982187266087016347332970280754062061156858775174056686380286868007443"), // ^9
+ mp_type("-3.598843235212085340458540018208389404888495232432127661083907575106196374913134E-6"), // ^11
+ mp_type("+5.692172921967926811775255303592184372902829756054598109818158853197797542565E-8"), // ^13
+ mp_type("-6.688035109811467232478226335783138689956270985704278659373558497256423498E-10"), // ^15
+ mp_type("+6.066935731106195667101445665327140070166203261129845646380005577490472E-12"), // ^17
+ mp_type("-4.377065467313742277184271313776319094862897030084226361576452003432E-14"), // ^19
+ mp_type("+2.571422892860473866153865950420487369167895373255729246889168337E-16"), // ^21
+ mp_type("-1.253899540535457665340073300390626396596970180355253776711660E-18"), // ^23
+ mp_type("+5.15645517658028233395375998562329055050964428219501277474E-21"), // ^25
+ mp_type("-1.812399312848887477410034071087545686586497030654642705E-23"), // ^27
+ mp_type("+5.50728578652238583570585513920522536675023562254864E-26"), // ^29
+ mp_type("-1.461148710664467988723468673933026649943084902958E-28"), // ^31
+ mp_type("+3.41405297003316172502972039913417222912445427E-31"), // ^33
+ mp_type("-7.07885550810745570069916712806856538290251E-34"), // ^35
+ mp_type("+1.31128947968267628970845439024155655665E-36"), // ^37
+ mp_type("-2.18318293181145698535113946654065918E-39"), // ^39
+ mp_type("+3.28462680978498856345937578502923E-42"), // ^41
+ mp_type("-4.48753699028101089490067137298E-45"), // ^43
+ mp_type("+5.59219884208696457859353716E-48"), // ^45
+ mp_type("-6.38214503973500471720565E-51"), // ^47
+ mp_type("+6.69528558381794452556E-54"), // ^49
+ mp_type("-6.47841373182350206E-57"), // ^51
+ mp_type("+5.800016389666445E-60"), // ^53
+ mp_type("-4.818507347289E-63"), // ^55
+ mp_type("+3.724683686E-66"), // ^57
+ mp_type("-2.6856479E-69"), // ^59
+ mp_type("+1.81046E-72"), // ^61
+ mp_type("-1.133E-75"), // ^63
+ }};
+
+ const mp_type v = x * 2 / boost::math::constants::pi<mp_type>();
+ const mp_type x2 = (v * v);
+ //
+ // Polynomial evaluation follows, if mp_type allocates memory then
+ // just one such allocation occurs - to initialize the variable "sum" -
+ // and no temporaries are created at all.
+ //
+ const mp_type sum = ((((((((((((((((((((((((((((((( + coefs[31U]
+ * x2 + coefs[30U])
+ * x2 + coefs[29U])
+ * x2 + coefs[28U])
+ * x2 + coefs[27U])
+ * x2 + coefs[26U])
+ * x2 + coefs[25U])
+ * x2 + coefs[24U])
+ * x2 + coefs[23U])
+ * x2 + coefs[22U])
+ * x2 + coefs[21U])
+ * x2 + coefs[20U])
+ * x2 + coefs[19U])
+ * x2 + coefs[18U])
+ * x2 + coefs[17U])
+ * x2 + coefs[16U])
+ * x2 + coefs[15U])
+ * x2 + coefs[14U])
+ * x2 + coefs[13U])
+ * x2 + coefs[12U])
+ * x2 + coefs[11U])
+ * x2 + coefs[10U])
+ * x2 + coefs[9U])
+ * x2 + coefs[8U])
+ * x2 + coefs[7U])
+ * x2 + coefs[6U])
+ * x2 + coefs[5U])
+ * x2 + coefs[4U])
+ * x2 + coefs[3U])
+ * x2 + coefs[2U])
+ * x2 + coefs[1U])
+ * x2 + coefs[0U])
+ * v;
+
+ return sum;
+}
+
+/*`
+Calling the function like so:
+
+ std::cout << std::setprecision(std::numeric_limits<::mp_type>::digits10) << std::scientific;
+ std::cout << mysin(mp_type(1)) << std::endl;
+
+Yields the expected output:
+
+[pre 7.0710678118654752440084436210484903928483593768847403658833986900e-01]
+
+*/
+
+//]
+
+
int main()
{
using namespace boost::multiprecision;
@@ -542,6 +657,10 @@
//]
+ 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;
}
@@ -562,4 +681,6 @@
4.99999999999999999999999999999999999999999999999999e-01
2.70670566473225383787998989944968806815263091819151e-01
2.70670566473225383787998989944968806815253190143120e-01
+7.0710678118654752440084436210484903928483593768847403658833986900e-01
+7.0710678118654752440084436210484903928483593768847403658833986900e-01
*/
\ No newline at end of file
Added: sandbox/big_number/libs/multiprecision/example/integer_examples.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/example/integer_examples.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -0,0 +1,231 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 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 <boost/multiprecision/cpp_int.hpp>
+#include <iostream>
+#include <iomanip>
+#include <vector>
+
+//[FAC1
+
+/*`
+In this simple example, we'll write a routine to print out all of the factorials
+which will fit into a 128-bit integer. At the end of the routine we do some
+fancy iostream formatting of the results:
+*/
+/*=
+#include <boost/multiprecision/cpp_int.hpp>
+#include <iostream>
+#include <iomanip>
+#include <vector>
+*/
+
+void print_factorials()
+{
+ using boost::multiprecision::cpp_int;
+ //
+ // Print all the factorials that will fit inside a 128-bit integer.
+ //
+ // Begin by building a big table of factorials, once we know just how
+ // large the largest is, we'll be able to "pretty format" the results.
+ //
+ // Calculate the largest number that will fit inside 128 bits, we could
+ // also have used numeric_limits<mp_int128_t>::max() for this value:
+ cpp_int limit = (cpp_int(1) << 128) - 1;
+ //
+ // Our table of values:
+ std::vector<cpp_int> results;
+ //
+ // Initial values:
+ unsigned i = 1;
+ cpp_int factorial = 1;
+ //
+ // Cycle through the factorials till we reach the limit:
+ while(factorial < limit)
+ {
+ results.push_back(factorial);
+ ++i;
+ factorial *= i;
+ }
+ //
+ // Lets see how many digits the largest factorial was:
+ unsigned digits = results.back().str().size();
+ //
+ // Now print them out, using right justification, while we're at it
+ // we'll indicate the limit of each integer type, so begin by defining
+ // the limits for 16, 32, 64 etc bit integers:
+ cpp_int limits[] = {
+ (cpp_int(1) << 16) - 1,
+ (cpp_int(1) << 32) - 1,
+ (cpp_int(1) << 64) - 1,
+ (cpp_int(1) << 128) - 1,
+ };
+ std::string bit_counts[] = { "16", "32", "64", "128" };
+ unsigned current_limit = 0;
+ for(unsigned j = 0; j < results.size(); ++j)
+ {
+ if(limits[current_limit] < results[j])
+ {
+ std::string message = "Limit of " + bit_counts[current_limit] + " bit integers";
+ std::cout << std::setfill('.') << std::setw(digits+1) << std::right << message << std::setfill(' ') << std::endl;
+ ++current_limit;
+ }
+ std::cout << std::setw(digits + 1) << std::right << results[j] << std::endl;
+ }
+}
+
+/*`
+The output from this routine is:
+[template nul[]] [# fix for quickbook bug]
+[pre [nul]
+ 1
+ 2
+ 6
+ 24
+ 120
+ 720
+ 5040
+ 40320
+................Limit of 16 bit integers
+ 362880
+ 3628800
+ 39916800
+ 479001600
+................Limit of 32 bit integers
+ 6227020800
+ 87178291200
+ 1307674368000
+ 20922789888000
+ 355687428096000
+ 6402373705728000
+ 121645100408832000
+ 2432902008176640000
+................Limit of 64 bit integers
+ 51090942171709440000
+ 1124000727777607680000
+ 25852016738884976640000
+ 620448401733239439360000
+ 15511210043330985984000000
+ 403291461126605635584000000
+ 10888869450418352160768000000
+ 304888344611713860501504000000
+ 8841761993739701954543616000000
+ 265252859812191058636308480000000
+ 8222838654177922817725562880000000
+ 263130836933693530167218012160000000
+ 8683317618811886495518194401280000000
+ 295232799039604140847618609643520000000
+]
+*/
+
+//]
+
+//[BITOPS
+
+/*`
+In this example we'll show how individual bits within an integer may be manipulated,
+we'll start with an often needed calculation of ['2[super n] - 1], which we could obviously
+implement like this:
+*/
+
+using boost::multiprecision::cpp_int;
+
+cpp_int b1(unsigned n)
+{
+ cpp_int r(1);
+ return (r << n) - 1;
+}
+
+/*`
+Calling:
+
+ std::cout << std::hex << std::showbase << b1(200) << std::endl;
+
+Yields as expected:
+
+[pre 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF]
+
+However, we could equally just set the n'th bit in the result, like this:
+*/
+
+cpp_int b2(unsigned n)
+{
+ cpp_int r(0);
+ return --bit_set(r, n);
+}
+
+/*`
+Note how the `bit_set` function sets the specified bit in it's argument and then returns a reference to the result -
+which we can then simply decrement. The result from a call to `b2` is the same as that to `b1`.
+
+We can equally test bits, so for example the n'th bit of the result returned from `b2` shouldn't be set
+unless we increment it first:
+
+ assert(!bit_test(b1(200), 200)); // OK
+ assert(bit_test(++b1(200), 200)); // OK
+
+And of course if we flip the n'th bit after increment, then we should get back to zero:
+
+ assert(!bit_flip(++b1(200), 200)); // OK
+*/
+
+//]
+
+int main()
+{
+ print_factorials();
+
+ std::cout << std::hex << std::showbase << b1(200) << std::endl;
+ std::cout << std::hex << std::showbase << b2(200) << std::endl;
+ assert(!bit_test(b1(200), 200)); // OK
+ assert(bit_test(++b1(200), 200)); // OK
+ assert(!bit_flip(++b1(200), 200)); // OK
+ return 0;
+}
+
+/*
+
+Program output:
+
+ 1
+ 2
+ 6
+ 24
+ 120
+ 720
+ 5040
+ 40320
+................Limit of 16 bit integers
+ 362880
+ 3628800
+ 39916800
+ 479001600
+................Limit of 32 bit integers
+ 6227020800
+ 87178291200
+ 1307674368000
+ 20922789888000
+ 355687428096000
+ 6402373705728000
+ 121645100408832000
+ 2432902008176640000
+................Limit of 64 bit integers
+ 51090942171709440000
+ 1124000727777607680000
+ 25852016738884976640000
+ 620448401733239439360000
+ 15511210043330985984000000
+ 403291461126605635584000000
+ 10888869450418352160768000000
+ 304888344611713860501504000000
+ 8841761993739701954543616000000
+ 265252859812191058636308480000000
+ 8222838654177922817725562880000000
+ 263130836933693530167218012160000000
+ 8683317618811886495518194401280000000
+ 295232799039604140847618609643520000000
+ 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+ 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+ */
\ No newline at end of file
Modified: sandbox/big_number/libs/multiprecision/test/test_acos.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_acos.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_acos.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -102,6 +102,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
Modified: sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -447,7 +447,7 @@
BOOST_TEST(trunc(Real(5) / 2) == 2);
BOOST_TEST(trunc(Real(-5) / 2) == -2);
//
- // ldexp and frexp, these pretty much have to implemented by each backend:
+ // ldexp and frexp, these pretty much have to be implemented by each backend:
//
BOOST_TEST(ldexp(Real(2), 5) == 64);
BOOST_TEST(ldexp(Real(2), -5) == Real(2) / 32);
@@ -461,6 +461,19 @@
r = frexp(v, &exp);
BOOST_TEST(r == 0.5);
BOOST_TEST(exp == -8);
+ typedef typename Real::backend_type::exponent_type e_type;
+ BOOST_TEST(ldexp(Real(2), e_type(5)) == 64);
+ BOOST_TEST(ldexp(Real(2), e_type(-5)) == Real(2) / 32);
+ v = 512;
+ e_type exp2;
+ r = frexp(v, &exp2);
+ BOOST_TEST(r == 0.5);
+ BOOST_TEST(exp2 == 10);
+ BOOST_TEST(v == 512);
+ v = 1 / v;
+ r = frexp(v, &exp2);
+ BOOST_TEST(r == 0.5);
+ BOOST_TEST(exp2 == -8);
//
// pow and exp:
//
Modified: sandbox/big_number/libs/multiprecision/test/test_asin.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_asin.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_asin.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -98,6 +98,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
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-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -244,6 +244,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
Modified: sandbox/big_number/libs/multiprecision/test/test_cos.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_cos.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_cos.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -298,6 +298,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
Modified: sandbox/big_number/libs/multiprecision/test/test_cosh.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_cosh.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_cosh.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -140,6 +140,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
Modified: sandbox/big_number/libs/multiprecision/test/test_exp.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_exp.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_exp.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -180,6 +180,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
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-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -191,6 +191,7 @@
template <class T>
T generate_random()
{
+ typedef typename T::backend_type::exponent_type e_type;
static boost::random::mt19937 gen;
T val = gen();
T prev_val = -1;
@@ -200,10 +201,9 @@
prev_val = val;
val += gen();
}
- int e;
+ e_type e;
val = frexp(val, &e);
- typedef typename T::backend_type::exponent_type e_type;
static boost::random::uniform_int_distribution<e_type> ui(0, std::numeric_limits<T>::max_exponent - 10);
return ldexp(val, ui(gen));
}
@@ -260,11 +260,11 @@
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_log.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_log.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_log.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -208,6 +208,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
Modified: sandbox/big_number/libs/multiprecision/test/test_pow.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_pow.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_pow.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -583,6 +583,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
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-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -389,6 +389,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
#ifdef TEST_BACKEND
test<boost::multiprecision::mp_number<boost::multiprecision::concepts::mp_number_backend_float_architype> >();
Modified: sandbox/big_number/libs/multiprecision/test/test_sin.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_sin.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_sin.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -291,6 +291,16 @@
#endif
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
+ test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
Modified: sandbox/big_number/libs/multiprecision/test/test_sinh.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_sinh.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_sinh.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -216,6 +216,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
Modified: sandbox/big_number/libs/multiprecision/test/test_sqrt.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_sqrt.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_sqrt.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -186,6 +186,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
Modified: sandbox/big_number/libs/multiprecision/test/test_tanh.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_tanh.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_tanh.cpp 2012-04-13 11:38:28 EDT (Fri, 13 Apr 2012)
@@ -135,6 +135,15 @@
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
test<boost::multiprecision::cpp_dec_float_100>();
+ // Some "peculiar" digit counts which stress our code:
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<65> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<64> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<63> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<62> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<61> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<60> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<59> > >();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<58> > >();
#endif
return boost::report_errors();
}
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