Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82046 - in trunk: boost/multiprecision libs/multiprecision/doc libs/multiprecision/doc/html libs/multiprecision/doc/html/boost_multiprecision/indexes libs/multiprecision/doc/html/boost_multiprecision/ref libs/multiprecision/doc/html/boost_multiprecision/tut/floats
From: john_at_[hidden]
Date: 2012-12-17 08:11:03


Author: johnmaddock
Date: 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
New Revision: 82046
URL: http://svn.boost.org/trac/boost/changeset/82046

Log:
Add static asserts on ExponentType requirements.
Document requirements better.
Regenerate docs.
Text files modified:
   trunk/boost/multiprecision/cpp_dec_float.hpp | 4 ++++
   trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html | 4 ++--
   trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html | 4 ++--
   trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html | 4 ++--
   trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html | 4 ++--
   trunk/libs/multiprecision/doc/html/boost_multiprecision/ref/cpp_dec_ref.html | 33 ++++++++++++++++++++++++++-------
   trunk/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html | 3 ++-
   trunk/libs/multiprecision/doc/html/index.html | 2 +-
   trunk/libs/multiprecision/doc/multiprecision.qbk | 18 +++++++++++++-----
   9 files changed, 54 insertions(+), 22 deletions(-)

Modified: trunk/boost/multiprecision/cpp_dec_float.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_dec_float.hpp (original)
+++ trunk/boost/multiprecision/cpp_dec_float.hpp 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
@@ -73,6 +73,10 @@
 private:
    static const boost::int32_t cpp_dec_float_digits10_setting = Digits10;
 
+ // We need at least 16-bits in the exponent type to do anything sensible:
+ BOOST_STATIC_ASSERT_MSG(sizeof(ExponentType) > 1, "ExponentType is too small.");
+ BOOST_STATIC_ASSERT_MSG(boost::is_signed<ExponentType>::value, "ExponentType must be a signed built in integer type.");
+
 public:
    typedef mpl::list<long long> signed_types;
    typedef mpl::list<unsigned long long> unsigned_types;

Modified: trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html
==============================================================================
--- trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html (original)
+++ trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
@@ -22,9 +22,9 @@
 <div class="spirit-nav">
 <a accesskey="p" href="../indexes.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="s02.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
 </div>
-<div class="section id975046">
+<div class="section id971278">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="id975046"></a>Function Index</h3></div></div></div>
+<a name="id971278"></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: trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html
==============================================================================
--- trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html (original)
+++ trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
@@ -22,9 +22,9 @@
 <div class="spirit-nav">
 <a accesskey="p" href="s01.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="s03.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
 </div>
-<div class="section id981123">
+<div class="section id976856">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="id981123"></a>Class Index</h3></div></div></div>
+<a name="id976856"></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: trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html
==============================================================================
--- trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html (original)
+++ trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
@@ -22,9 +22,9 @@
 <div class="spirit-nav">
 <a accesskey="p" href="s02.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="s04.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
 </div>
-<div class="section id981540">
+<div class="section id977273">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="id981540"></a>Typedef Index</h3></div></div></div>
+<a name="id977273"></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: trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html
==============================================================================
--- trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html (original)
+++ trunk/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
@@ -21,9 +21,9 @@
 <div class="spirit-nav">
 <a accesskey="p" href="s03.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a>
 </div>
-<div class="section id982540">
+<div class="section id978273">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="id982540"></a>Index</h3></div></div></div>
+<a name="id978273"></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: trunk/libs/multiprecision/doc/html/boost_multiprecision/ref/cpp_dec_ref.html
==============================================================================
--- trunk/libs/multiprecision/doc/html/boost_multiprecision/ref/cpp_dec_ref.html (original)
+++ trunk/libs/multiprecision/doc/html/boost_multiprecision/ref/cpp_dec_ref.html 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
@@ -28,7 +28,7 @@
 </h3></div></div></div>
 <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">multiprecision</span><span class="special">{</span>
 
-<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="identifier">Digits10</span><span class="special">&gt;</span>
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="identifier">Digits10</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExponentType</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">int32_t</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span> <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span>
 <span class="keyword">class</span> <span class="identifier">cpp_dec_float</span><span class="special">;</span>
 
 <span class="keyword">typedef</span> <span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float</span><span class="special">&lt;</span><span class="number">50</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">cpp_dec_float_50</span><span class="special">;</span>
@@ -43,13 +43,32 @@
         these are considered implementation details that are subject to change.
       </p>
 <p>
- The class takes a single template parameter - <code class="computeroutput"><span class="identifier">Digits10</span></code>
- - which is the number of decimal digits precision the type should support.
- Note that this type does not ever perform any dynamic memory allocation,
- as a result the <code class="computeroutput"><span class="identifier">Digits10</span></code>
- template argument should not be set too high or the class's size will grow
- unreasonably large.
+ The class takes three template parameters:
       </p>
+<div class="variablelist">
+<p class="title"><b></b></p>
+<dl class="variablelist">
+<dt><span class="term">Digits10</span></dt>
+<dd><p>
+ The number of decimal digits precision the type should support. Note
+ that this type does not normally perform any dynamic memory allocation,
+ and as a result the <code class="computeroutput"><span class="identifier">Digits10</span></code>
+ template argument should not be set too high or the class's size will
+ grow unreasonably large.
+ </p></dd>
+<dt><span class="term">ExponentType</span></dt>
+<dd><p>
+ A signed integer type that represents the exponent of the number
+ </p></dd>
+<dt><span class="term">Allocator</span></dt>
+<dd><p>
+ The allocator used: defaults to type <code class="computeroutput"><span class="keyword">void</span></code>,
+ meaning all storage is within the class, and no dynamic allocation
+ is performed, but can be set to a standard library allocator if dynamic
+ allocation makes more sense.
+ </p></dd>
+</dl>
+</div>
 <p>
         The type of <code class="computeroutput"><span class="identifier">number_category</span><span class="special">&lt;</span><span class="identifier">cpp_int</span><span class="special">&lt;</span><span class="identifier">Args</span><span class="special">...&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span></code> is <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special">&lt;</span><span class="identifier">number_kind_floating_point</span><span class="special">&gt;</span></code>.
       </p>

Modified: trunk/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html
==============================================================================
--- trunk/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html (original)
+++ trunk/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
@@ -56,7 +56,8 @@
           to a 32-bit integer type which is more than large enough for the vast majority
           of use cases, but larger types such as <code class="computeroutput"><span class="keyword">long</span>
           <span class="keyword">long</span></code> can also be specified if you
- need a truely huge exponent range.
+ need a truely huge exponent range. In any case the ExponentType must be
+ a built in signed integer type at least 2 bytes and 16-bits wide.
         </p>
 <p>
           Normally <code class="computeroutput"><span class="identifier">cpp_dec_float</span></code>

Modified: trunk/libs/multiprecision/doc/html/index.html
==============================================================================
--- trunk/libs/multiprecision/doc/html/index.html (original)
+++ trunk/libs/multiprecision/doc/html/index.html 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
@@ -136,7 +136,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: December 14, 2012 at 18:29:25 GMT</small></p></td>
+<td align="left"><p><small>Last revised: December 17, 2012 at 13:02:44 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: trunk/libs/multiprecision/doc/multiprecision.qbk
==============================================================================
--- trunk/libs/multiprecision/doc/multiprecision.qbk (original)
+++ trunk/libs/multiprecision/doc/multiprecision.qbk 2012-12-17 08:11:01 EST (Mon, 17 Dec 2012)
@@ -655,7 +655,8 @@
 The typedefs `cpp_dec_float_50` and `cpp_dec_float_100` provide arithmetic types at 50 and 100 decimal digits precision
 respectively. Optionally, you can specify an integer type to use for the exponent, this defaults to a 32-bit integer type
 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.
+if you need a truely huge exponent range. In any case the ExponentType must be a built in signed integer type at least 2 bytes
+and 16-bits wide.
 
 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
@@ -2196,7 +2197,7 @@
 
    namespace boost{ namespace multiprecision{
 
- template <unsigned Digits10>
+ template <unsigned Digits10, class ExponentType = boost::int32_t, class Allocator = void>
    class cpp_dec_float;
 
    typedef number<cpp_dec_float<50> > cpp_dec_float_50;
@@ -2208,9 +2209,16 @@
 Its members and non-member functions are deliberately not documented: these are considered implementation details that are subject
 to change.
 
-The class takes a single template parameter - `Digits10` - which is the number of decimal digits precision the type
-should support. Note that this type does not ever perform any dynamic memory allocation, as a result the `Digits10`
-template argument should not be set too high or the class's size will grow unreasonably large.
+The class takes three template parameters:
+
+[variablelist
+[[Digits10][The number of decimal digits precision the type
+should support. Note that this type does not normally perform any dynamic memory allocation, and as a result the `Digits10`
+template argument should not be set too high or the class's size will grow unreasonably large.]]
+[[ExponentType][A signed integer type that represents the exponent of the number]]
+[[Allocator][The allocator used: defaults to type `void`, meaning all storage is within the class, and no dynamic
+allocation is performed, but can be set to a standard library allocator if dynamic allocation makes more sense.]]
+]
 
 The type of `number_category<cpp_int<Args...> >::type` is `mpl::int_<number_kind_floating_point>`.
 


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