mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-07-21 13:23:49 +00:00
Add debug_adaptor.hpp.
Document debug_adaptor and VC++ visualizers. [SVN r82517]
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
@@ -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 id991981">
|
||||
<div class="section id991181">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id991981"></a>Function Index</h3></div></div></div>
|
||||
<a name="id991181"></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_11">O</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">V</a> <a class="link" href="s01.html#idx_id_18">Z</a></p>
|
||||
<div class="variablelist"><dl class="variablelist">
|
||||
<dt>
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
<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 id995998">
|
||||
<div class="section id995591">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id995998"></a>Class Index</h3></div></div></div>
|
||||
<p><a class="link" href="s02.html#idx_id_21">C</a> <a class="link" href="s02.html#idx_id_23">E</a> <a class="link" href="s02.html#idx_id_25">G</a> <a class="link" href="s02.html#idx_id_26">I</a> <a class="link" href="s02.html#idx_id_27">L</a> <a class="link" href="s02.html#idx_id_28">M</a> <a class="link" href="s02.html#idx_id_29">N</a> <a class="link" href="s02.html#idx_id_34">T</a></p>
|
||||
<a name="id995591"></a>Class Index</h3></div></div></div>
|
||||
<p><a class="link" href="s02.html#idx_id_21">C</a> <a class="link" href="s02.html#idx_id_22">D</a> <a class="link" href="s02.html#idx_id_23">E</a> <a class="link" href="s02.html#idx_id_25">G</a> <a class="link" href="s02.html#idx_id_26">I</a> <a class="link" href="s02.html#idx_id_27">L</a> <a class="link" href="s02.html#idx_id_28">M</a> <a class="link" href="s02.html#idx_id_29">N</a> <a class="link" href="s02.html#idx_id_34">T</a></p>
|
||||
<div class="variablelist"><dl class="variablelist">
|
||||
<dt>
|
||||
<a name="idx_id_21"></a><span class="term">C</span>
|
||||
@@ -42,6 +42,10 @@
|
||||
</li>
|
||||
</ul></div></dd>
|
||||
<dt>
|
||||
<a name="idx_id_22"></a><span class="term">D</span>
|
||||
</dt>
|
||||
<dd><div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/misc/debug_adaptor.html" title="debug_adaptor"><span class="index-entry-level-0">debug_adaptor</span></a></p></li></ul></div></dd>
|
||||
<dt>
|
||||
<a name="idx_id_23"></a><span class="term">E</span>
|
||||
</dt>
|
||||
<dd><div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none">
|
||||
|
||||
@@ -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 id996458">
|
||||
<div class="section id996076">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id996458"></a>Typedef Index</h3></div></div></div>
|
||||
<a name="id996076"></a>Typedef Index</h3></div></div></div>
|
||||
<p><a class="link" href="s03.html#idx_id_40">C</a> <a class="link" href="s03.html#idx_id_45">I</a> <a class="link" href="s03.html#idx_id_46">L</a> <a class="link" href="s03.html#idx_id_47">M</a> <a class="link" href="s03.html#idx_id_52">S</a> <a class="link" href="s03.html#idx_id_53">T</a> <a class="link" href="s03.html#idx_id_54">U</a></p>
|
||||
<div class="variablelist"><dl class="variablelist">
|
||||
<dt>
|
||||
|
||||
@@ -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 id997505">
|
||||
<div class="section id998761">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id997505"></a>Index</h3></div></div></div>
|
||||
<a name="id998761"></a>Index</h3></div></div></div>
|
||||
<p><a class="link" href="s04.html#idx_id_57">A</a> <a class="link" href="s04.html#idx_id_58">B</a> <a class="link" href="s04.html#idx_id_59">C</a> <a class="link" href="s04.html#idx_id_60">D</a> <a class="link" href="s04.html#idx_id_61">E</a> <a class="link" href="s04.html#idx_id_62">F</a> <a class="link" href="s04.html#idx_id_63">G</a> <a class="link" href="s04.html#idx_id_64">I</a> <a class="link" href="s04.html#idx_id_65">L</a> <a class="link" href="s04.html#idx_id_66">M</a> <a class="link" href="s04.html#idx_id_67">N</a> <a class="link" href="s04.html#idx_id_68">O</a> <a class="link" href="s04.html#idx_id_69">P</a> <a class="link" href="s04.html#idx_id_70">R</a> <a class="link" href="s04.html#idx_id_71">S</a> <a class="link" href="s04.html#idx_id_72">T</a> <a class="link" href="s04.html#idx_id_73">U</a> <a class="link" href="s04.html#idx_id_74">V</a> <a class="link" href="s04.html#idx_id_75">Z</a></p>
|
||||
<div class="variablelist"><dl class="variablelist">
|
||||
<dt>
|
||||
@@ -237,6 +237,7 @@
|
||||
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">mpfr_float</span></a></p></li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/misc/debug_adaptor.html" title="debug_adaptor"><span class="index-entry-level-0">debug_adaptor</span></a></p></li>
|
||||
<li class="listitem" style="list-style-type: none">
|
||||
<p><span class="index-entry-level-0">default_precision</span></p>
|
||||
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
|
||||
|
||||
@@ -68,7 +68,12 @@
|
||||
<dt><span class="section"><a href="tut/rational/rational_adaptor.html">rational_adaptor</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="tut/misc.html">Miscellaneous Number Types.</a></span></dt>
|
||||
<dd><dl><dt><span class="section"><a href="tut/misc/logged_adaptor.html">logged_adaptor</a></span></dt></dl></dd>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="tut/misc/logged_adaptor.html">logged_adaptor</a></span></dt>
|
||||
<dt><span class="section"><a href="tut/misc/debug_adaptor.html">debug_adaptor</a></span></dt>
|
||||
<dt><span class="section"><a href="tut/misc/visualizers.html">Visual C++
|
||||
Debugger Visualizers</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="tut/conversions.html">Constructing and
|
||||
Interconverting Between Number Types</a></span></dt>
|
||||
<dt><span class="section"><a href="tut/random.html">Generating Random Numbers</a></span></dt>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Multiprecision">
|
||||
<link rel="up" href="../tut.html" title="Tutorial">
|
||||
<link rel="prev" href="misc/logged_adaptor.html" title="logged_adaptor">
|
||||
<link rel="prev" href="misc/visualizers.html" title="Visual C++ Debugger Visualizers">
|
||||
<link rel="next" href="random.html" title="Generating Random Numbers">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="misc/logged_adaptor.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="random.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="misc/visualizers.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="random.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section boost_multiprecision_tut_conversions">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
@@ -171,7 +171,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="misc/logged_adaptor.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="random.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="misc/visualizers.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.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="random.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -26,7 +26,12 @@
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_multiprecision.tut.misc"></a><a class="link" href="misc.html" title="Miscellaneous Number Types.">Miscellaneous Number Types.</a>
|
||||
</h3></div></div></div>
|
||||
<div class="toc"><dl><dt><span class="section"><a href="misc/logged_adaptor.html">logged_adaptor</a></span></dt></dl></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="misc/logged_adaptor.html">logged_adaptor</a></span></dt>
|
||||
<dt><span class="section"><a href="misc/debug_adaptor.html">debug_adaptor</a></span></dt>
|
||||
<dt><span class="section"><a href="misc/visualizers.html">Visual C++
|
||||
Debugger Visualizers</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
Backend types listed in this section are predominantly designed to aid debugging.
|
||||
</p>
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>debug_adaptor</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Multiprecision">
|
||||
<link rel="up" href="../misc.html" title="Miscellaneous Number Types.">
|
||||
<link rel="prev" href="logged_adaptor.html" title="logged_adaptor">
|
||||
<link rel="next" href="visualizers.html" title="Visual C++ Debugger Visualizers">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="logged_adaptor.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.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="visualizers.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section boost_multiprecision_tut_misc_debug_adaptor">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_multiprecision.tut.misc.debug_adaptor"></a><a class="link" href="debug_adaptor.html" title="debug_adaptor">debug_adaptor</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="preprocessor">#include</span> <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">debug_adaptor</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<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"><</span><span class="identifier">Backend</span><span class="special">></span>
|
||||
<span class="keyword">class</span> <span class="identifier">debug_adaptor</span><span class="special">;</span>
|
||||
|
||||
<span class="special">}}</span> <span class="comment">// namespaces</span>
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput"><span class="identifier">debug_adaptor</span></code> type
|
||||
is used in conjunction with <code class="computeroutput"><span class="identifier">number</span></code>
|
||||
and some other backend type: it acts as a thin wrapper around some other
|
||||
backend to class <code class="computeroutput"><span class="identifier">number</span></code>
|
||||
and intercepts all operations on that object storing the result as a string
|
||||
within itself.
|
||||
</p>
|
||||
<p>
|
||||
This type provides <code class="computeroutput"><span class="identifier">numeric_limits</span></code>
|
||||
support whenever the template argument Backend does so.
|
||||
</p>
|
||||
<p>
|
||||
This type is particularly useful when your debugger provides a good view
|
||||
of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>: when this is the case multiprecision
|
||||
values can easily be inspected in the debugger by looking at the <code class="computeroutput"><span class="identifier">debug_value</span></code> member of <code class="computeroutput"><span class="identifier">debug_adapter</span></code>.
|
||||
The down side of this approach is that runtimes are much slower when using
|
||||
this type. Set against that it can make debugging very much easier, certainly
|
||||
much easier than sprinkling code with <code class="computeroutput"><span class="identifier">printf</span></code>
|
||||
statements.
|
||||
</p>
|
||||
<p>
|
||||
When used in conjunction with the Visual C++ debugger visualisers, the
|
||||
value of a multiprecision type that uses this backend is displayed in the
|
||||
debugger just a builtin value would be, here we're inspecting a value of
|
||||
type <code class="computeroutput"><span class="identifier">number</span><span class="special"><</span><span class="identifier">debug_adapter</span><span class="special"><</span><span class="identifier">cpp_dec_float</span><span class="special"><</span><span class="number">50</span><span class="special">></span> <span class="special">></span>
|
||||
<span class="special">></span></code>:
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../../debugger1.png" alt="debugger1"></span>
|
||||
</p>
|
||||
<p>
|
||||
Otherwise you will need to expand out the view and look at the "debug_value"
|
||||
member:
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../../debugger2.png" alt="debugger2"></span>
|
||||
</p>
|
||||
<p>
|
||||
It works for all the backend types equally too, here it is inspecting a
|
||||
<code class="computeroutput"><span class="identifier">number</span><span class="special"><</span><span class="identifier">debug_adapter</span><span class="special"><</span><span class="identifier">gmp_rational</span><span class="special">></span>
|
||||
<span class="special">></span></code>:
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../../debugger3.png" alt="debugger3"></span>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2002-2012 John Maddock and Christopher Kormanyos<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="logged_adaptor.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.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="visualizers.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -7,7 +7,7 @@
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Multiprecision">
|
||||
<link rel="up" href="../misc.html" title="Miscellaneous Number Types.">
|
||||
<link rel="prev" href="../misc.html" title="Miscellaneous Number Types.">
|
||||
<link rel="next" href="../conversions.html" title="Constructing and Interconverting Between Number Types">
|
||||
<link rel="next" href="debug_adaptor.html" title="debug_adaptor">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../misc.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.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="../conversions.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="../misc.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.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="debug_adaptor.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section boost_multiprecision_tut_misc_logged_adaptor">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
@@ -217,7 +217,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../misc.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.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="../conversions.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="../misc.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.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="debug_adaptor.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Visual C++ Debugger Visualizers</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Multiprecision">
|
||||
<link rel="up" href="../misc.html" title="Miscellaneous Number Types.">
|
||||
<link rel="prev" href="debug_adaptor.html" title="debug_adaptor">
|
||||
<link rel="next" href="../conversions.html" title="Constructing and Interconverting Between Number Types">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="debug_adaptor.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.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="../conversions.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section boost_multiprecision_tut_misc_visualizers">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_multiprecision.tut.misc.visualizers"></a><a class="link" href="visualizers.html" title="Visual C++ Debugger Visualizers">Visual C++
|
||||
Debugger Visualizers</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Let's face it debugger multiprecision numbers is hard - simply because
|
||||
we can't easily inspect the value of the numbers. Visual C++ provides a
|
||||
partial solution in the shape of "visualizers" which provide
|
||||
improved views of complex data structures, these visualizers need to be
|
||||
added to the <code class="computeroutput"><span class="special">[</span><span class="identifier">Visualizer</span><span class="special">]</span></code> section of <code class="computeroutput"><span class="identifier">autoexp</span><span class="special">.</span><span class="identifier">dat</span></code>
|
||||
located in the <code class="computeroutput"><span class="identifier">Common7</span><span class="special">\</span><span class="identifier">Packages</span><span class="special">\</span><span class="identifier">Debugger</span></code>
|
||||
directory of your Visual Studio installation.
|
||||
</p>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>
|
||||
These visualizers have only been tested with VC10, also given the ability
|
||||
of buggy visualizers to crash your Visual C++ debugger, make sure you
|
||||
back up <code class="computeroutput"><span class="identifier">autoexp</span><span class="special">.</span><span class="identifier">dat</span></code> file before using these!!
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
This visualizer provides improved views of <code class="computeroutput"><span class="identifier">debug_adaptor</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting">boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<<span class="bold"><strong>>,</strong></span>>{
|
||||
preview(
|
||||
#(
|
||||
$e.m_backend.debug_value
|
||||
)
|
||||
)
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
The next visualizer provides improved views of cpp_int: small numbers are
|
||||
displayed as actual values, while larger numbers are displayed as an array
|
||||
of hexadecimal parts, with the most significant part first.
|
||||
</p>
|
||||
<p>
|
||||
Here's what it looks like for small values:
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../../debugger4.png" alt="debugger4"></span>
|
||||
</p>
|
||||
<p>
|
||||
And for larger values:
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../../debugger5.png" alt="debugger5"></span>
|
||||
</p>
|
||||
<p>
|
||||
There is also a <code class="computeroutput"><span class="special">~</span><span class="identifier">raw</span></code>
|
||||
child member that lets you see the actual members of the class:
|
||||
</p>
|
||||
<p>
|
||||
<span class="inlinemediaobject"><img src="../../../../debugger6.png" alt="debugger6"></span>
|
||||
</p>
|
||||
<p>
|
||||
Here's the visualizer code:
|
||||
</p>
|
||||
<pre class="programlisting">boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<<span class="bold"><strong>,</strong></span>,1,<span class="bold"><strong>,void>,</strong></span>>{
|
||||
preview(
|
||||
#if($e.m_backend.m_limbs == 1) (
|
||||
#if($e.m_backend.m_sign) ( -1 * (__int64)($e.m_backend.m_wrapper.m_data[0]) ) #else ($e.m_backend.m_wrapper.m_data[0])
|
||||
)
|
||||
#elif(($e.m_backend.m_limbs == 2) && ($e.m_backend.m_wrapper.m_data[1] < 0x80000000)) (
|
||||
#if($e.m_backend.m_sign) ( -1 * (__int64)($e.m_backend.m_wrapper.m_data[0] | ((__int64)$e.m_backend.m_wrapper.m_data[1] << 32)) ) #else ($e.m_backend.m_wrapper.m_data[0] | ((__int64)$e.m_backend.m_wrapper.m_data[1] << 32))
|
||||
) #else (
|
||||
#( "signbit = ", $e.m_backend.m_sign, " data = ", #array ( expr: $e.m_backend.m_wrapper.m_data[$e.m_backend.m_limbs - $i - 1], size: $e.m_backend.m_limbs ) : [$e,x] )
|
||||
)
|
||||
)
|
||||
|
||||
children (
|
||||
#(
|
||||
~raw: [$c,!],
|
||||
sign bit: $e.m_backend.m_sign,
|
||||
#array (
|
||||
expr: $e.m_backend.m_wrapper.m_data[$e.m_backend.m_limbs - $i - 1],
|
||||
size: $e.m_backend.m_limbs
|
||||
) : [$e,x]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<<span class="bold"><strong>,</strong></span>,0,<span class="bold"><strong>,void>,</strong></span>>{
|
||||
preview(
|
||||
#if($e.m_backend.m_limbs == 1) (
|
||||
$e.m_backend.m_wrapper.m_data[0]
|
||||
)
|
||||
#elif($e.m_backend.m_limbs == 2) (
|
||||
$e.m_backend.m_wrapper.m_data[0] | ((__int64)$e.m_backend.m_wrapper.m_data[1] << 32)
|
||||
) #else (
|
||||
#array ( expr: $e.m_backend.m_wrapper.m_data[$e.m_backend.m_limbs - $i - 1], size: $e.m_backend.m_limbs ) : [$e,x]
|
||||
)
|
||||
)
|
||||
|
||||
children (
|
||||
#(
|
||||
~raw: [$c,!],
|
||||
#array (
|
||||
expr: $e.m_backend.m_wrapper.m_data[$e.m_backend.m_limbs - $i - 1],
|
||||
size: $e.m_backend.m_limbs
|
||||
) : [$e,x]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<0,0,1,<span class="bold"><strong>,</strong></span>>,*>{
|
||||
preview(
|
||||
#if ($e.m_backend.m_internal) (
|
||||
#if($e.m_backend.m_limbs == 1) (
|
||||
#if($e.m_backend.m_sign) ( -1 * (__int64)($e.m_backend.m_data.first) ) #else($e.m_backend.m_data.first)
|
||||
) #elif(($e.m_backend.m_limbs == 2) && ($e.m_backend.m_data.la[1] < 0x80000000)) (
|
||||
#if($e.m_backend.m_sign) ( -1 * (__int64)($e.m_backend.m_data.double_first) ) #else($e.m_backend.m_data.double_first)
|
||||
) #else(
|
||||
#( "signbit = ", $e.m_backend.m_sign, " data = ", #array ( expr: $e.m_backend.m_data.la[$e.m_backend.m_limbs - $i - 1], size: $e.m_backend.m_limbs ) : [$e,x] )
|
||||
)
|
||||
) #else(
|
||||
#if($e.m_backend.m_limbs == 1) (
|
||||
#if($e.m_backend.m_sign) ( -1 * (__int64)($e.m_backend.m_data.ld.data[0]) ) #else($e.m_backend.m_data.ld.data[0])
|
||||
) #elif(($e.m_backend.m_limbs == 2) && ($e.m_backend.m_data.ld.data[1] < 0x80000000)) (
|
||||
#if($e.m_backend.m_sign) ( -1 * (__int64)($e.m_backend.m_data.ld.data[0] | ((__int64)$e.m_backend.m_data.ld.data[1] << 32)) ) #else($e.m_backend.m_data.ld.data[0] | ((__int64)$e.m_backend.m_data.ld.data[1] << 32))
|
||||
) #else(
|
||||
#( "signbit = ", $e.m_backend.m_sign, " data = ", #array ( expr: $e.m_backend.m_data.ld.data[$e.m_backend.m_limbs - $i - 1], size: $e.m_backend.m_limbs ) : [$e,x] )
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
children (
|
||||
#if ($e.m_backend.m_internal) (
|
||||
#if($e.m_backend.m_limbs == 1) (
|
||||
#(value: $e.m_backend.m_data.first)
|
||||
) #elif($e.m_backend.m_limbs == 1) (
|
||||
#(value: $e.m_backend.m_data.double_first)
|
||||
) #else (
|
||||
#(
|
||||
sign bit: $e.m_backend.m_sign,
|
||||
#array (
|
||||
expr: $e.m_backend.m_data.la[$e.m_backend.m_limbs - $i - 1],
|
||||
size: $e.m_backend.m_limbs
|
||||
) : [$e,x]
|
||||
)
|
||||
)
|
||||
) #else (
|
||||
#(
|
||||
~raw: [$c,!],
|
||||
sign bit: $e.m_backend.m_sign,
|
||||
#array (
|
||||
expr: $e.m_backend.m_data.ld.data[$e.m_backend.m_limbs - $i - 1],
|
||||
size: $e.m_backend.m_limbs
|
||||
) : [$e,x]
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2002-2012 John Maddock and Christopher Kormanyos<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="debug_adaptor.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.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="../conversions.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+7
-2
@@ -83,7 +83,12 @@
|
||||
<dt><span class="section"><a href="boost_multiprecision/tut/rational/rational_adaptor.html">rational_adaptor</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_multiprecision/tut/misc.html">Miscellaneous Number Types.</a></span></dt>
|
||||
<dd><dl><dt><span class="section"><a href="boost_multiprecision/tut/misc/logged_adaptor.html">logged_adaptor</a></span></dt></dl></dd>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_multiprecision/tut/misc/logged_adaptor.html">logged_adaptor</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_multiprecision/tut/misc/debug_adaptor.html">debug_adaptor</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_multiprecision/tut/misc/visualizers.html">Visual C++
|
||||
Debugger Visualizers</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_multiprecision/tut/conversions.html">Constructing and
|
||||
Interconverting Between Number Types</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_multiprecision/tut/random.html">Generating Random Numbers</a></span></dt>
|
||||
@@ -140,7 +145,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: January 15, 2013 at 11:39:36 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: January 17, 2013 at 12:12:57 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
||||
@@ -1254,6 +1254,184 @@ When we examine program output we can clearly see that the diameter of the inter
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:debug_adaptor debug_adaptor]
|
||||
|
||||
`#include <boost/multiprecision/debug_adaptor.hpp>`
|
||||
|
||||
namespace boost{ namespace multiprecision{
|
||||
|
||||
template <Backend>
|
||||
class debug_adaptor;
|
||||
|
||||
}} // namespaces
|
||||
|
||||
The `debug_adaptor` type is used in conjunction with `number` and some other backend type: it acts as a thin wrapper around
|
||||
some other backend to class `number` and intercepts all operations on that object storing the result as a string within itself.
|
||||
|
||||
This type provides `numeric_limits` support whenever the template argument Backend does so.
|
||||
|
||||
This type is particularly useful when your debugger provides a good view of `std::string`: when this is the case
|
||||
multiprecision values can easily be inspected in the debugger by looking at the `debug_value` member of `debug_adapter`.
|
||||
The down side of this approach is that runtimes are much slower when using this type. Set against that it can make
|
||||
debugging very much easier, certainly much easier than sprinkling code with `printf` statements.
|
||||
|
||||
When used in conjunction with the Visual C++ debugger visualisers, the value of a multiprecision type that uses this
|
||||
backend is displayed in the debugger just a builtin value would be, here we're inspecting a value of type
|
||||
`number<debug_adapter<cpp_dec_float<50> > >`:
|
||||
|
||||
[$../debugger1.png]
|
||||
|
||||
Otherwise you will need to expand out the view and look at the "debug_value" member:
|
||||
|
||||
[$../debugger2.png]
|
||||
|
||||
It works for all the backend types equally too, here it is inspecting a `number<debug_adapter<gmp_rational> >`:
|
||||
|
||||
[$../debugger3.png]
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:visualizers Visual C++ Debugger Visualizers]
|
||||
|
||||
Let's face it debugger multiprecision numbers is hard - simply because we can't easily inspect the value of the numbers.
|
||||
Visual C++ provides a partial solution in the shape of "visualizers" which provide improved views of complex data structures,
|
||||
these visualizers need to be added to the `[Visualizer]` section of `autoexp.dat` located in the `Common7\Packages\Debugger`
|
||||
directory of your Visual Studio installation.
|
||||
|
||||
[note These visualizers have only been tested with VC10, also given the ability of buggy visualizers to crash your Visual C++
|
||||
debugger, make sure you back up `autoexp.dat` file before using these!!]
|
||||
|
||||
This visualizer provides improved views of `debug_adaptor`:
|
||||
|
||||
[pre
|
||||
boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<*>,*>{
|
||||
preview(
|
||||
\#(
|
||||
\$e.m_backend.debug_value
|
||||
)
|
||||
)
|
||||
}
|
||||
]
|
||||
|
||||
The next visualizer provides improved views of cpp_int: small numbers are displayed as actual values, while larger numbers are
|
||||
displayed as an array of hexadecimal parts, with the most significant part first.
|
||||
|
||||
Here's what it looks like for small values:
|
||||
|
||||
[$../debugger4.png]
|
||||
|
||||
And for larger values:
|
||||
|
||||
[$../debugger5.png]
|
||||
|
||||
There is also a `~raw` child member that
|
||||
lets you see the actual members of the class:
|
||||
|
||||
[$../debugger6.png]
|
||||
|
||||
Here's the visualizer code:
|
||||
|
||||
[pre
|
||||
boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<*,*,1,*,void>,*>{
|
||||
preview(
|
||||
\#if(\$e.m_backend.m_limbs == 1) (
|
||||
\#if(\$e.m_backend.m_sign) ( -1 * (__int64)(\$e.m_backend.m_wrapper.m_data\[0\]) ) \#else (\$e.m_backend.m_wrapper.m_data\[0\])
|
||||
)
|
||||
\#elif((\$e.m_backend.m_limbs == 2) && (\$e.m_backend.m_wrapper.m_data\[1\] < 0x80000000)) (
|
||||
\#if(\$e.m_backend.m_sign) ( -1 * (__int64)(\$e.m_backend.m_wrapper.m_data\[0\] | ((__int64)\$e.m_backend.m_wrapper.m_data\[1\] << 32)) ) \#else (\$e.m_backend.m_wrapper.m_data\[0\] | ((__int64)\$e.m_backend.m_wrapper.m_data\[1\] << 32))
|
||||
) \#else (
|
||||
\#( "signbit = ", \$e.m_backend.m_sign, " data = ", \#array ( expr: \$e.m_backend.m_wrapper.m_data\[\$e.m_backend.m_limbs - \$i - 1\], size: \$e.m_backend.m_limbs ) : \[\$e,x\] )
|
||||
)
|
||||
)
|
||||
|
||||
children (
|
||||
\#(
|
||||
\~raw: \[\$c,!\],
|
||||
sign bit: \$e.m_backend.m_sign,
|
||||
\#array (
|
||||
expr: \$e.m_backend.m_wrapper.m_data\[\$e.m_backend.m_limbs - \$i - 1\],
|
||||
size: \$e.m_backend.m_limbs
|
||||
) : \[\$e,x\]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<*,*,0,*,void>,*>{
|
||||
preview(
|
||||
\#if(\$e.m_backend.m_limbs == 1) (
|
||||
\$e.m_backend.m_wrapper.m_data\[0\]
|
||||
)
|
||||
\#elif(\$e.m_backend.m_limbs == 2) (
|
||||
\$e.m_backend.m_wrapper.m_data\[0\] | ((__int64)\$e.m_backend.m_wrapper.m_data\[1\] << 32)
|
||||
) \#else (
|
||||
\#array ( expr: \$e.m_backend.m_wrapper.m_data\[\$e.m_backend.m_limbs - \$i - 1\], size: \$e.m_backend.m_limbs ) : \[\$e,x\]
|
||||
)
|
||||
)
|
||||
|
||||
children (
|
||||
\#(
|
||||
\~raw: \[\$c,!\],
|
||||
\#array (
|
||||
expr: \$e.m_backend.m_wrapper.m_data\[\$e.m_backend.m_limbs - \$i - 1\],
|
||||
size: \$e.m_backend.m_limbs
|
||||
) : \[\$e,x\]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<0,0,1,*,*>,*>{
|
||||
preview(
|
||||
\#if (\$e.m_backend.m_internal) (
|
||||
\#if(\$e.m_backend.m_limbs == 1) (
|
||||
\#if(\$e.m_backend.m_sign) ( -1 * (__int64)(\$e.m_backend.m_data.first) ) \#else(\$e.m_backend.m_data.first)
|
||||
) \#elif((\$e.m_backend.m_limbs == 2) && (\$e.m_backend.m_data.la\[1\] < 0x80000000)) (
|
||||
\#if(\$e.m_backend.m_sign) ( -1 * (__int64)(\$e.m_backend.m_data.double_first) ) \#else(\$e.m_backend.m_data.double_first)
|
||||
) \#else(
|
||||
\#( "signbit = ", \$e.m_backend.m_sign, " data = ", \#array ( expr: \$e.m_backend.m_data.la\[\$e.m_backend.m_limbs - \$i - 1\], size: \$e.m_backend.m_limbs ) : \[\$e,x\] )
|
||||
)
|
||||
) \#else(
|
||||
\#if(\$e.m_backend.m_limbs == 1) (
|
||||
\#if(\$e.m_backend.m_sign) ( -1 * (__int64)(\$e.m_backend.m_data.ld.data\[0\]) ) \#else(\$e.m_backend.m_data.ld.data\[0\])
|
||||
) \#elif((\$e.m_backend.m_limbs == 2) && (\$e.m_backend.m_data.ld.data\[1\] < 0x80000000)) (
|
||||
\#if(\$e.m_backend.m_sign) ( -1 * (__int64)(\$e.m_backend.m_data.ld.data\[0\] | ((__int64)\$e.m_backend.m_data.ld.data\[1\] << 32)) ) \#else(\$e.m_backend.m_data.ld.data\[0\] | ((__int64)\$e.m_backend.m_data.ld.data\[1\] << 32))
|
||||
) \#else(
|
||||
\#( "signbit = ", \$e.m_backend.m_sign, " data = ", \#array ( expr: \$e.m_backend.m_data.ld.data\[\$e.m_backend.m_limbs - \$i - 1\], size: \$e.m_backend.m_limbs ) : \[\$e,x\] )
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
children (
|
||||
\#if (\$e.m_backend.m_internal) (
|
||||
\#if(\$e.m_backend.m_limbs == 1) (
|
||||
\#(value: \$e.m_backend.m_data.first)
|
||||
) \#elif(\$e.m_backend.m_limbs == 1) (
|
||||
\#(value: \$e.m_backend.m_data.double_first)
|
||||
) \#else (
|
||||
\#(
|
||||
sign bit: \$e.m_backend.m_sign,
|
||||
\#array (
|
||||
expr: \$e.m_backend.m_data.la\[\$e.m_backend.m_limbs - \$i - 1\],
|
||||
size: \$e.m_backend.m_limbs
|
||||
) : \[\$e,x\]
|
||||
)
|
||||
)
|
||||
) \#else (
|
||||
\#(
|
||||
\~raw: \[\$c,!\],
|
||||
sign bit: \$e.m_backend.m_sign,
|
||||
\#array (
|
||||
expr: \$e.m_backend.m_data.ld.data\[\$e.m_backend.m_limbs - \$i - 1\],
|
||||
size: \$e.m_backend.m_limbs
|
||||
) : \[\$e,x\]
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:conversions Constructing and Interconverting Between Number Types]
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// 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 <boost/multiprecision/mpfr.hpp>
|
||||
#include <boost/multiprecision/debug_adaptor.hpp>
|
||||
#include <iostream>
|
||||
|
||||
void t1()
|
||||
{
|
||||
//[debug_adaptor_eg
|
||||
//=#include <boost/multiprecision/debug_adaptor.hpp>
|
||||
//=#include <boost/multiprecision/cpp_dec_float.hpp>
|
||||
|
||||
using namespace boost::multiprecision;
|
||||
|
||||
typedef number<debug_adaptor<cpp_dec_float<50> > > fp_type;
|
||||
|
||||
fp_type denom = 1;
|
||||
fp_type sum = 1;
|
||||
|
||||
for(unsigned i = 2; i < 50; ++i)
|
||||
{
|
||||
denom *= i;
|
||||
sum += 1 / denom;
|
||||
}
|
||||
|
||||
std::cout << std::setprecision(std::numeric_limits<fp_type>::digits) << sum << std::endl;
|
||||
//]
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
t1();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,453 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// 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_
|
||||
|
||||
#ifndef BOOST_MATH_DEBUG_ADAPTER_HPP
|
||||
#define BOOST_MATH_DEBUG_ADAPTER_HPP
|
||||
|
||||
#include <boost/multiprecision/traits/extract_exponent_type.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace multiprecision{
|
||||
namespace backends{
|
||||
|
||||
template <class Backend>
|
||||
struct debug_adaptor
|
||||
{
|
||||
typedef typename Backend::signed_types signed_types;
|
||||
typedef typename Backend::unsigned_types unsigned_types;
|
||||
typedef typename Backend::float_types float_types;
|
||||
typedef typename extract_exponent_type<
|
||||
Backend, number_category<Backend>::value>::type exponent_type;
|
||||
|
||||
private:
|
||||
std::string debug_value;
|
||||
Backend m_value;
|
||||
public:
|
||||
void update_view()
|
||||
{
|
||||
try
|
||||
{
|
||||
debug_value = m_value.str(0, static_cast<std::ios_base::fmtflags>(0));
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
debug_value = "String conversion failed with message: \"";
|
||||
debug_value += e.what();
|
||||
debug_value += "\"";
|
||||
}
|
||||
}
|
||||
debug_adaptor()
|
||||
{
|
||||
update_view();
|
||||
}
|
||||
debug_adaptor(const debug_adaptor& o) : debug_value(o.debug_value), m_value(o.m_value)
|
||||
{
|
||||
}
|
||||
debug_adaptor& operator = (const debug_adaptor& o)
|
||||
{
|
||||
debug_value = o.debug_value;
|
||||
m_value = o.m_value;
|
||||
return *this;
|
||||
}
|
||||
template <class T>
|
||||
debug_adaptor(const T& i, const typename enable_if_c<is_convertible<T, Backend>::value>::type* = 0)
|
||||
: m_value(i)
|
||||
{
|
||||
update_view();
|
||||
}
|
||||
template <class T>
|
||||
debug_adaptor(const T& i, const T& j)
|
||||
: m_value(i, j)
|
||||
{
|
||||
update_view();
|
||||
}
|
||||
template <class T>
|
||||
typename enable_if_c<is_arithmetic<T>::value || is_convertible<T, Backend>::value, debug_adaptor&>::type operator = (const T& i)
|
||||
{
|
||||
m_value = i;
|
||||
update_view();
|
||||
return *this;
|
||||
}
|
||||
debug_adaptor& operator = (const char* s)
|
||||
{
|
||||
m_value = s;
|
||||
update_view();
|
||||
return *this;
|
||||
}
|
||||
void swap(debug_adaptor& o)
|
||||
{
|
||||
std::swap(m_value, o.value());
|
||||
std::swap(debug_value, o.debug_value);
|
||||
}
|
||||
std::string str(std::streamsize digits, std::ios_base::fmtflags f)const
|
||||
{
|
||||
return m_value.str(digits, f);
|
||||
}
|
||||
void negate()
|
||||
{
|
||||
m_value.negate();
|
||||
update_view();
|
||||
}
|
||||
int compare(const debug_adaptor& o)const
|
||||
{
|
||||
return m_value.compare(o.value());
|
||||
}
|
||||
template <class T>
|
||||
int compare(const T& i)const
|
||||
{
|
||||
return m_value.compare(i);
|
||||
}
|
||||
Backend& value()
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
const Backend& value()const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
};
|
||||
|
||||
template <class Backend>
|
||||
inline Backend const& unwrap_debug_type(debug_adaptor<Backend> const& val)
|
||||
{
|
||||
return val.value();
|
||||
}
|
||||
template <class T>
|
||||
inline const T& unwrap_debug_type(const T& val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
#define NON_MEMBER_OP1(name, str) \
|
||||
template <class Backend>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value());\
|
||||
result.update_view();\
|
||||
}
|
||||
|
||||
#define NON_MEMBER_OP2(name, str) \
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a));\
|
||||
result.update_view();\
|
||||
}
|
||||
|
||||
#define NON_MEMBER_OP3(name, str) \
|
||||
template <class Backend, class T, class U>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const U& b)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const T& b)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const debug_adaptor<Backend>& b)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
|
||||
result.update_view();\
|
||||
}
|
||||
|
||||
#define NON_MEMBER_OP4(name, str) \
|
||||
template <class Backend, class T, class U, class V>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const U& b, const V& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b, const T& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const T& b, const debug_adaptor<Backend>& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const debug_adaptor<Backend>& b, const debug_adaptor<Backend>& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b, const debug_adaptor<Backend>& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T, class U>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const T& b, const U& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
|
||||
NON_MEMBER_OP2(add, "+=");
|
||||
NON_MEMBER_OP2(subtract, "-=");
|
||||
NON_MEMBER_OP2(multiply, "*=");
|
||||
NON_MEMBER_OP2(divide, "/=");
|
||||
|
||||
template <class Backend, class R>
|
||||
inline void eval_convert_to(R* result, const debug_adaptor<Backend>& val)
|
||||
{
|
||||
using default_ops::eval_convert_to;
|
||||
eval_convert_to(result, val.value());
|
||||
}
|
||||
|
||||
template <class Backend, class Exp>
|
||||
inline void eval_frexp(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& arg, Exp* exp)
|
||||
{
|
||||
eval_frexp(result.value(), arg.value(), exp);
|
||||
result.update_view();\
|
||||
}
|
||||
|
||||
template <class Backend, class Exp>
|
||||
inline void eval_ldexp(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& arg, Exp exp)
|
||||
{
|
||||
eval_ldexp(result.value(), arg.value(), exp);
|
||||
result.update_view();\
|
||||
}
|
||||
|
||||
NON_MEMBER_OP2(floor, "floor");
|
||||
NON_MEMBER_OP2(ceil, "ceil");
|
||||
NON_MEMBER_OP2(sqrt, "sqrt");
|
||||
|
||||
template <class Backend>
|
||||
inline int eval_fpclassify(const debug_adaptor<Backend>& arg)
|
||||
{
|
||||
using default_ops::eval_fpclassify;
|
||||
return eval_fpclassify(arg.value());
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Optional arithmetic operations come next:
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
NON_MEMBER_OP3(add, "+");
|
||||
NON_MEMBER_OP3(subtract, "-");
|
||||
NON_MEMBER_OP3(multiply, "*");
|
||||
NON_MEMBER_OP3(divide, "/");
|
||||
NON_MEMBER_OP3(multiply_add, "fused-multiply-add");
|
||||
NON_MEMBER_OP3(multiply_subtract, "fused-multiply-subtract");
|
||||
NON_MEMBER_OP4(multiply_add, "fused-multiply-add");
|
||||
NON_MEMBER_OP4(multiply_subtract, "fused-multiply-subtract");
|
||||
|
||||
NON_MEMBER_OP1(increment, "increment");
|
||||
NON_MEMBER_OP1(decrement, "decrement");
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Optional integer operations come next:
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
NON_MEMBER_OP2(modulus, "%=");
|
||||
NON_MEMBER_OP3(modulus, "%");
|
||||
NON_MEMBER_OP2(bitwise_or, "|=");
|
||||
NON_MEMBER_OP3(bitwise_or, "|");
|
||||
NON_MEMBER_OP2(bitwise_and, "&=");
|
||||
NON_MEMBER_OP3(bitwise_and, "&");
|
||||
NON_MEMBER_OP2(bitwise_xor, "^=");
|
||||
NON_MEMBER_OP3(bitwise_xor, "^");
|
||||
NON_MEMBER_OP4(qr, "quotient-and-remainder");
|
||||
NON_MEMBER_OP2(complement, "~");
|
||||
|
||||
template <class Backend>
|
||||
inline void eval_left_shift(debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_left_shift;
|
||||
eval_left_shift(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_left_shift(debug_adaptor<Backend>& arg, const debug_adaptor<Backend>& a, unsigned b)
|
||||
{
|
||||
using default_ops::eval_left_shift;
|
||||
eval_left_shift(arg.value(), a, b);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_right_shift(debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_right_shift;
|
||||
eval_right_shift(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_right_shift(debug_adaptor<Backend>& arg, const debug_adaptor<Backend>& a, unsigned b)
|
||||
{
|
||||
using default_ops::eval_right_shift;
|
||||
eval_right_shift(arg.value(), a, b);
|
||||
arg.update_view();\
|
||||
}
|
||||
|
||||
template <class Backend, class T>
|
||||
inline unsigned eval_integer_modulus(const debug_adaptor<Backend>& arg, const T& a)
|
||||
{
|
||||
using default_ops::eval_integer_modulus;
|
||||
return eval_integer_modulus(arg.value(), a);
|
||||
}
|
||||
|
||||
template <class Backend>
|
||||
inline unsigned eval_lsb(const debug_adaptor<Backend>& arg)
|
||||
{
|
||||
using default_ops::eval_lsb;
|
||||
return eval_lsb(arg.value());
|
||||
}
|
||||
|
||||
template <class Backend>
|
||||
inline bool eval_bit_test(const debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_bit_test;
|
||||
return eval_bit_test(arg.value(), a);
|
||||
}
|
||||
|
||||
template <class Backend>
|
||||
inline void eval_bit_set(const debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_bit_set;
|
||||
eval_bit_set(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_bit_unset(const debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_bit_unset;
|
||||
eval_bit_unset(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_bit_flip(const debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_bit_flip;
|
||||
eval_bit_flip(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
|
||||
NON_MEMBER_OP3(gcd, "gcd");
|
||||
NON_MEMBER_OP3(lcm, "lcm");
|
||||
NON_MEMBER_OP4(powm, "powm");
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* abs/fabs:
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
NON_MEMBER_OP2(abs, "abs");
|
||||
NON_MEMBER_OP2(fabs, "fabs");
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Floating point functions:
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
NON_MEMBER_OP2(trunc, "trunc");
|
||||
NON_MEMBER_OP2(round, "round");
|
||||
NON_MEMBER_OP2(exp, "exp");
|
||||
NON_MEMBER_OP2(log, "log");
|
||||
NON_MEMBER_OP2(log10, "log10");
|
||||
NON_MEMBER_OP2(sin, "sin");
|
||||
NON_MEMBER_OP2(cos, "cos");
|
||||
NON_MEMBER_OP2(tan, "tan");
|
||||
NON_MEMBER_OP2(asin, "asin");
|
||||
NON_MEMBER_OP2(acos, "acos");
|
||||
NON_MEMBER_OP2(atan, "atan");
|
||||
NON_MEMBER_OP2(sinh, "sinh");
|
||||
NON_MEMBER_OP2(cosh, "cosh");
|
||||
NON_MEMBER_OP2(tanh, "tanh");
|
||||
NON_MEMBER_OP3(fmod, "fmod");
|
||||
NON_MEMBER_OP3(pow, "pow");
|
||||
NON_MEMBER_OP3(atan2, "atan2");
|
||||
|
||||
} // namespace backends
|
||||
|
||||
using backends::debug_adaptor;
|
||||
|
||||
template<class Backend>
|
||||
struct number_category<backends::debug_adaptor<Backend> > : public number_category<Backend> {};
|
||||
|
||||
}} // namespaces
|
||||
|
||||
namespace std{
|
||||
|
||||
template <class Backend, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<Backend>, ExpressionTemplates> >
|
||||
: public std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> >
|
||||
{
|
||||
typedef std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> > base_type;
|
||||
typedef boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<Backend>, ExpressionTemplates> number_type;
|
||||
public:
|
||||
static number_type (min)() BOOST_NOEXCEPT { return (base_type::min)(); }
|
||||
static number_type (max)() BOOST_NOEXCEPT { return (base_type::max)(); }
|
||||
static number_type lowest() BOOST_NOEXCEPT { return -(max)(); }
|
||||
static number_type epsilon() BOOST_NOEXCEPT { return base_type::epsilon(); }
|
||||
static number_type round_error() BOOST_NOEXCEPT { return epsilon() / 2; }
|
||||
static number_type infinity() BOOST_NOEXCEPT { return base_type::infinity(); }
|
||||
static number_type quiet_NaN() BOOST_NOEXCEPT { return base_type::quiet_NaN(); }
|
||||
static number_type signaling_NaN() BOOST_NOEXCEPT { return base_type::signaling_NaN(); }
|
||||
static number_type denorm_min() BOOST_NOEXCEPT { return base_type::denorm_min(); }
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
namespace boost{ namespace math{
|
||||
|
||||
namespace policies{
|
||||
|
||||
template <class Backend, boost::multiprecision::expression_template_option ExpressionTemplates, class Policy>
|
||||
struct precision< boost::multiprecision::number<boost::multiprecision::debug_adaptor<Backend>, ExpressionTemplates>, Policy>
|
||||
: public precision<boost::multiprecision::number<Backend, ExpressionTemplates>, Policy>
|
||||
{};
|
||||
|
||||
#undef NON_MEMBER_OP1
|
||||
#undef NON_MEMBER_OP2
|
||||
#undef NON_MEMBER_OP3
|
||||
#undef NON_MEMBER_OP4
|
||||
|
||||
} // namespace policies
|
||||
|
||||
}} // namespaces boost::math
|
||||
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef BOOST_MATH_LOGGED_ADAPTER_HPP
|
||||
#define BOOST_MATH_LOGGED_ADAPTER_HPP
|
||||
|
||||
#include <boost/multiprecision/number.hpp>
|
||||
#include <boost/multiprecision/traits/extract_exponent_type.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace multiprecision{
|
||||
@@ -38,17 +38,6 @@ inline void log_prefix_event(const Backend&, const T&, const U&, const V&, const
|
||||
|
||||
namespace backends{
|
||||
|
||||
template <class Backend, int cat>
|
||||
struct extract_exponent_type
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
template <class Backend>
|
||||
struct extract_exponent_type<Backend, number_kind_floating_point>
|
||||
{
|
||||
typedef typename Backend::exponent_type type;
|
||||
};
|
||||
|
||||
template <class Backend>
|
||||
struct logged_adaptor
|
||||
{
|
||||
@@ -298,6 +287,7 @@ NON_MEMBER_OP2(sqrt, "sqrt");
|
||||
template <class Backend>
|
||||
inline int eval_fpclassify(const logged_adaptor<Backend>& arg)
|
||||
{
|
||||
using default_ops::eval_fpclassify;
|
||||
log_prefix_event(arg.value(), "fpclassify");
|
||||
int r = eval_fpclassify(arg.value());
|
||||
log_postfix_event(arg.value(), r, "fpclassify");
|
||||
@@ -508,5 +498,9 @@ struct precision< boost::multiprecision::number<boost::multiprecision::logged_ad
|
||||
|
||||
}} // namespaces boost::math
|
||||
|
||||
#undef NON_MEMBER_OP1
|
||||
#undef NON_MEMBER_OP2
|
||||
#undef NON_MEMBER_OP3
|
||||
#undef NON_MEMBER_OP4
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// 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_
|
||||
|
||||
#ifndef BOOST_MATH_EXTRACT_EXPONENT_HPP
|
||||
#define BOOST_MATH_EXTRACT_EXPONENT_HPP
|
||||
|
||||
#include <boost/multiprecision/number.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace multiprecision{
|
||||
namespace backends{
|
||||
|
||||
template <class Backend, int cat>
|
||||
struct extract_exponent_type
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
template <class Backend>
|
||||
struct extract_exponent_type<Backend, number_kind_floating_point>
|
||||
{
|
||||
typedef typename Backend::exponent_type type;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -104,6 +104,9 @@ run test_arithmetic_ab_3.cpp ;
|
||||
run test_arithmetic_logged_1.cpp ;
|
||||
run test_arithmetic_logged_2.cpp ;
|
||||
|
||||
run test_arithmetic_dbg_adptr1.cpp ;
|
||||
run test_arithmetic_dbg_adptr2.cpp ;
|
||||
|
||||
run test_arithmetic_mpfi_50.cpp mpfi mpfr gmp : : : [ check-target-builds ../config//has_mpfi : : <build>no ] ;
|
||||
|
||||
run test_numeric_limits.cpp
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// 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_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define _SCL_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#include <boost/multiprecision/debug_adaptor.hpp>
|
||||
#include <boost/multiprecision/cpp_dec_float.hpp>
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
test<boost::multiprecision::number<boost::multiprecision::debug_adaptor<boost::multiprecision::cpp_dec_float<50> > > >();
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// 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_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define _SCL_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#include <boost/multiprecision/debug_adaptor.hpp>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
test<boost::multiprecision::number<boost::multiprecision::debug_adaptor<boost::multiprecision::cpp_int_backend<> > > >();
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user