]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | |
4 | <title>Rational Number Types</title> | |
5 | <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> | |
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> | |
7 | <link rel="home" href="../../index.html" title="Chapter 1. Boost.Multiprecision"> | |
8 | <link rel="up" href="../tut.html" title="Tutorial"> | |
9 | <link rel="prev" href="interval/mpfi.html" title="mpfi_float"> | |
10 | <link rel="next" href="rational/cpp_rational.html" title="cpp_rational"> | |
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="interval/mpfi.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="rational/cpp_rational.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.tut.rational"></a><a class="link" href="rational.html" title="Rational Number Types">Rational Number Types</a> | |
28 | </h3></div></div></div> | |
29 | <div class="toc"><dl> | |
30 | <dt><span class="section"><a href="rational/cpp_rational.html">cpp_rational</a></span></dt> | |
31 | <dt><span class="section"><a href="rational/gmp_rational.html">gmp_rational</a></span></dt> | |
32 | <dt><span class="section"><a href="rational/tommath_rational.html">tommath_rational</a></span></dt> | |
33 | <dt><span class="section"><a href="rational/br.html">Use With Boost.Rational</a></span></dt> | |
34 | <dt><span class="section"><a href="rational/rational_adaptor.html">rational_adaptor</a></span></dt> | |
35 | </dl></div> | |
36 | <p> | |
37 | The following back-ends provide rational number arithmetic: | |
38 | </p> | |
39 | <div class="informaltable"><table class="table"> | |
40 | <colgroup> | |
41 | <col> | |
42 | <col> | |
43 | <col> | |
44 | <col> | |
45 | <col> | |
46 | <col> | |
47 | </colgroup> | |
48 | <thead><tr> | |
49 | <th> | |
50 | <p> | |
51 | Backend Type | |
52 | </p> | |
53 | </th> | |
54 | <th> | |
55 | <p> | |
56 | Header | |
57 | </p> | |
58 | </th> | |
59 | <th> | |
60 | <p> | |
61 | Radix | |
62 | </p> | |
63 | </th> | |
64 | <th> | |
65 | <p> | |
66 | Dependencies | |
67 | </p> | |
68 | </th> | |
69 | <th> | |
70 | <p> | |
71 | Pros | |
72 | </p> | |
73 | </th> | |
74 | <th> | |
75 | <p> | |
76 | Cons | |
77 | </p> | |
78 | </th> | |
79 | </tr></thead> | |
80 | <tbody> | |
81 | <tr> | |
82 | <td> | |
83 | <p> | |
84 | <code class="computeroutput"><span class="identifier">cpp_rational</span></code> | |
85 | </p> | |
86 | </td> | |
87 | <td> | |
88 | <p> | |
89 | boost/multiprecision/cpp_int.hpp | |
90 | </p> | |
91 | </td> | |
92 | <td> | |
93 | <p> | |
94 | 2 | |
95 | </p> | |
96 | </td> | |
97 | <td> | |
98 | <p> | |
99 | None | |
100 | </p> | |
101 | </td> | |
102 | <td> | |
103 | <p> | |
104 | An all C++ Boost-licensed implementation. | |
105 | </p> | |
106 | </td> | |
107 | <td> | |
108 | <p> | |
109 | Slower than <a href="http://gmplib.org" target="_top">GMP</a>. | |
110 | </p> | |
111 | </td> | |
112 | </tr> | |
113 | <tr> | |
114 | <td> | |
115 | <p> | |
116 | <code class="computeroutput"><span class="identifier">gmp_rational</span></code> | |
117 | </p> | |
118 | </td> | |
119 | <td> | |
120 | <p> | |
121 | boost/multiprecision/gmp.hpp | |
122 | </p> | |
123 | </td> | |
124 | <td> | |
125 | <p> | |
126 | 2 | |
127 | </p> | |
128 | </td> | |
129 | <td> | |
130 | <p> | |
131 | <a href="http://gmplib.org" target="_top">GMP</a> | |
132 | </p> | |
133 | </td> | |
134 | <td> | |
135 | <p> | |
136 | Very fast and efficient back-end. | |
137 | </p> | |
138 | </td> | |
139 | <td> | |
140 | <p> | |
141 | Dependency on GNU licensed <a href="http://gmplib.org" target="_top">GMP</a> | |
142 | library. | |
143 | </p> | |
144 | </td> | |
145 | </tr> | |
146 | <tr> | |
147 | <td> | |
148 | <p> | |
149 | <code class="computeroutput"><span class="identifier">tommath_rational</span></code> | |
150 | </p> | |
151 | </td> | |
152 | <td> | |
153 | <p> | |
154 | boost/multiprecision/tommath.hpp | |
155 | </p> | |
156 | </td> | |
157 | <td> | |
158 | <p> | |
159 | 2 | |
160 | </p> | |
161 | </td> | |
162 | <td> | |
163 | <p> | |
164 | <a href="http://libtom.org/?page=features&newsitems=5&whatfile=ltm" target="_top">libtommath</a> | |
165 | </p> | |
166 | </td> | |
167 | <td> | |
168 | <p> | |
169 | All C/C++ implementation that's Boost Software Licence compatible. | |
170 | </p> | |
171 | </td> | |
172 | <td> | |
173 | <p> | |
174 | Slower than <a href="http://gmplib.org" target="_top">GMP</a>. | |
175 | </p> | |
176 | </td> | |
177 | </tr> | |
178 | <tr> | |
179 | <td> | |
180 | <p> | |
181 | <code class="computeroutput"><span class="identifier">rational_adaptor</span></code> | |
182 | </p> | |
183 | </td> | |
184 | <td> | |
185 | <p> | |
186 | boost/multiprecision/rational_adaptor.hpp | |
187 | </p> | |
188 | </td> | |
189 | <td> | |
190 | <p> | |
191 | N/A | |
192 | </p> | |
193 | </td> | |
194 | <td> | |
195 | <p> | |
196 | none | |
197 | </p> | |
198 | </td> | |
199 | <td> | |
200 | <p> | |
201 | All C++ adaptor that allows any integer back-end type to be used | |
202 | as a rational type. | |
203 | </p> | |
204 | </td> | |
205 | <td> | |
206 | <p> | |
207 | Requires an underlying integer back-end type. | |
208 | </p> | |
209 | </td> | |
210 | </tr> | |
211 | <tr> | |
212 | <td> | |
213 | <p> | |
214 | <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">rational</span></code> | |
215 | </p> | |
216 | </td> | |
217 | <td> | |
218 | <p> | |
219 | boost/rational.hpp | |
220 | </p> | |
221 | </td> | |
222 | <td> | |
223 | <p> | |
224 | N/A | |
225 | </p> | |
226 | </td> | |
227 | <td> | |
228 | <p> | |
229 | None | |
230 | </p> | |
231 | </td> | |
232 | <td> | |
233 | <p> | |
234 | A C++ rational number type that can used with any <code class="computeroutput"><span class="identifier">number</span></code> integer type. | |
235 | </p> | |
236 | </td> | |
237 | <td> | |
238 | <p> | |
239 | The expression templates used by <code class="computeroutput"><span class="identifier">number</span></code> | |
240 | end up being "hidden" inside <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">rational</span></code>: | |
241 | performance may well suffer as a result. | |
242 | </p> | |
243 | </td> | |
244 | </tr> | |
245 | </tbody> | |
246 | </table></div> | |
247 | </div> | |
248 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
249 | <td align="left"></td> | |
250 | <td align="right"><div class="copyright-footer">Copyright © 2002-2013 John Maddock and Christopher Kormanyos<p> | |
251 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
252 | 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>) | |
253 | </p> | |
254 | </div></td> | |
255 | </tr></table> | |
256 | <hr> | |
257 | <div class="spirit-nav"> | |
258 | <a accesskey="p" href="interval/mpfi.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="rational/cpp_rational.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> | |
259 | </div> | |
260 | </body> | |
261 | </html> |