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">
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>
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>
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>
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>
37 The following back-ends provide rational number arithmetic:
39 <div class=
"informaltable"><table class=
"table">
84 <code class=
"computeroutput"><span class=
"identifier">cpp_rational
</span></code>
89 boost/multiprecision/cpp_int.hpp
104 An all C++ Boost-licensed implementation.
109 Slower than
<a href=
"http://gmplib.org" target=
"_top">GMP
</a>.
116 <code class=
"computeroutput"><span class=
"identifier">gmp_rational
</span></code>
121 boost/multiprecision/gmp.hpp
131 <a href=
"http://gmplib.org" target=
"_top">GMP
</a>
136 Very fast and efficient back-end.
141 Dependency on GNU licensed
<a href=
"http://gmplib.org" target=
"_top">GMP
</a>
149 <code class=
"computeroutput"><span class=
"identifier">tommath_rational
</span></code>
154 boost/multiprecision/tommath.hpp
164 <a href=
"http://libtom.org/?page=features&newsitems=5&whatfile=ltm" target=
"_top">libtommath
</a>
169 All C/C++ implementation that's Boost Software Licence compatible.
174 Slower than
<a href=
"http://gmplib.org" target=
"_top">GMP
</a>.
181 <code class=
"computeroutput"><span class=
"identifier">rational_adaptor
</span></code>
186 boost/multiprecision/rational_adaptor.hpp
201 All C++ adaptor that allows any integer back-end type to be used
207 Requires an underlying integer back-end type.
214 <code class=
"computeroutput"><span class=
"identifier">boost
</span><span class=
"special">::
</span><span class=
"identifier">rational
</span></code>
234 A C++ rational number type that can used with any
<code class=
"computeroutput"><span class=
"identifier">number
</span></code> integer type.
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.
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>)
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>