• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>gmp_float</title>
5<link rel="stylesheet" href="../../multiprecision.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../index.html" title="Chapter 1. Boost.Multiprecision">
8<link rel="up" href="../ref.html" title="Reference">
9<link rel="prev" href="tom_int_ref.html" title="tom_int">
10<link rel="next" href="mpfr_ref.html" title="mpfr_float_backend">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="tom_int_ref.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.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="mpfr_ref.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="boost_multiprecision.ref.mpf_ref"></a><a class="link" href="mpf_ref.html" title="gmp_float">gmp_float</a>
28</h3></div></div></div>
29<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>
30
31<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>
32<span class="keyword">class</span> <span class="identifier">gmp_float</span><span class="special">;</span>
33
34<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">gmp_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">mpf_float_50</span><span class="special">;</span>
35<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">gmp_float</span><span class="special">&lt;</span><span class="number">100</span><span class="special">&gt;</span> <span class="special">&gt;</span>   <span class="identifier">mpf_float_100</span><span class="special">;</span>
36<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">gmp_float</span><span class="special">&lt;</span><span class="number">500</span><span class="special">&gt;</span> <span class="special">&gt;</span>   <span class="identifier">mpf_float_500</span><span class="special">;</span>
37<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">gmp_float</span><span class="special">&lt;</span><span class="number">1000</span><span class="special">&gt;</span> <span class="special">&gt;</span>  <span class="identifier">mpf_float_1000</span><span class="special">;</span>
38<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">gmp_float</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span> <span class="special">&gt;</span>     <span class="identifier">mpf_float</span><span class="special">;</span>
39
40<span class="special">}}</span> <span class="comment">// namespaces</span>
41</pre>
42<p>
43        Class template <code class="computeroutput"><span class="identifier">gmp_float</span></code>
44        fulfils all of the requirements for a <a class="link" href="backendconc.html" title="Backend Requirements">Backend</a>
45        type. Its members and non-member functions are deliberately not documented:
46        these are considered implementation details that are subject to change.
47      </p>
48<p>
49        The class takes a single template parameter - <code class="computeroutput"><span class="identifier">Digits10</span></code>
50        - which is the number of decimal digits precision the type should support.
51        When this parameter is zero, then the precision can be set at runtime via
52        <code class="computeroutput"><span class="identifier">number</span><span class="special">::</span><span class="identifier">default_precision</span></code> and <code class="computeroutput"><span class="identifier">number</span><span class="special">::</span><span class="identifier">precision</span></code>.
53        Note that this type does not in any way change the GMP library's global state
54        (for example it does not change the default precision of the mpf_t data type),
55        therefore you can safely mix this type with existing code that uses GMP,
56        and also mix <code class="computeroutput"><span class="identifier">gmp_float</span></code>s of
57        differing precision.
58      </p>
59<p>
60        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>.
61      </p>
62<p>
63        More information on this type can be found in the <a class="link" href="../tut/floats/gmp_float.html" title="gmp_float">tutorial</a>.
64      </p>
65</div>
66<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
67<td align="left"></td>
68<td align="right"><div class="copyright-footer">Copyright © 2002-2020 John
69      Maddock and Christopher Kormanyos<p>
70        Distributed under the Boost Software License, Version 1.0. (See accompanying
71        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>)
72      </p>
73</div></td>
74</tr></table>
75<hr>
76<div class="spirit-nav">
77<a accesskey="p" href="tom_int_ref.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.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="mpfr_ref.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
78</div>
79</body>
80</html>
81