1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Floating-point Types</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="../tut.html" title="Tutorial"> 9<link rel="prev" href="ints/egs/bitops.html" title="Bit Operations"> 10<link rel="next" href="floats/cpp_bin_float.html" title="cpp_bin_float"> 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="ints/egs/bitops.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="floats/cpp_bin_float.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.floats"></a><a class="link" href="floats.html" title="Floating-point Types">Floating-point Types</a> 28</h3></div></div></div> 29<div class="toc"><dl class="toc"> 30<dt><span class="section"><a href="floats/cpp_bin_float.html">cpp_bin_float</a></span></dt> 31<dt><span class="section"><a href="floats/cpp_dec_float.html">cpp_dec_float</a></span></dt> 32<dt><span class="section"><a href="floats/gmp_float.html">gmp_float</a></span></dt> 33<dt><span class="section"><a href="floats/mpfr_float.html">mpfr_float</a></span></dt> 34<dt><span class="section"><a href="floats/float128.html">float128</a></span></dt> 35<dt><span class="section"><a href="floats/fp_eg.html">Examples</a></span></dt> 36<dd><dl> 37<dt><span class="section"><a href="floats/fp_eg/aos.html">Area of 38 Circle</a></span></dt> 39<dt><span class="section"><a href="floats/fp_eg/caveats.html">Drop-in 40 Caveats</a></span></dt> 41<dt><span class="section"><a href="floats/fp_eg/jel.html">Defining 42 a Special Function.</a></span></dt> 43<dt><span class="section"><a href="floats/fp_eg/nd.html">Calculating 44 a Derivative</a></span></dt> 45<dt><span class="section"><a href="floats/fp_eg/gi.html">Calculating 46 an Integral</a></span></dt> 47<dt><span class="section"><a href="floats/fp_eg/poly_eg.html">Polynomial 48 Evaluation</a></span></dt> 49<dt><span class="section"><a href="floats/fp_eg/variable_precision.html">Variable-Precision 50 Newton Evaluation</a></span></dt> 51<dt><span class="section"><a href="floats/fp_eg/gauss_lagerre_quadrature.html">Gauss-Laguerre 52 quadrature</a></span></dt> 53</dl></dd> 54</dl></div> 55<p> 56 The following back-ends provide floating-point arithmetic: 57 </p> 58<div class="informaltable"><table class="table"> 59<colgroup> 60<col> 61<col> 62<col> 63<col> 64<col> 65<col> 66</colgroup> 67<thead><tr> 68<th> 69 <p> 70 Backend Type 71 </p> 72 </th> 73<th> 74 <p> 75 Header 76 </p> 77 </th> 78<th> 79 <p> 80 Radix 81 </p> 82 </th> 83<th> 84 <p> 85 Dependencies 86 </p> 87 </th> 88<th> 89 <p> 90 Pros 91 </p> 92 </th> 93<th> 94 <p> 95 Cons 96 </p> 97 </th> 98</tr></thead> 99<tbody> 100<tr> 101<td> 102 <p> 103 <code class="computeroutput"><span class="identifier">cpp_bin_float</span><span class="special"><</span><span class="identifier">N</span><span class="special">></span></code> 104 </p> 105 </td> 106<td> 107 <p> 108 boost/multiprecision/cpp_bin_float.hpp 109 </p> 110 </td> 111<td> 112 <p> 113 2 114 </p> 115 </td> 116<td> 117 <p> 118 None 119 </p> 120 </td> 121<td> 122 <p> 123 Header only, all C++ implementation. Boost licence. 124 </p> 125 </td> 126<td> 127 <p> 128 Approximately 2x slower than the <a href="http://www.mpfr.org" target="_top">MPFR</a> 129 or <a href="http://gmplib.org" target="_top">GMP</a> libraries. 130 </p> 131 </td> 132</tr> 133<tr> 134<td> 135 <p> 136 <code class="computeroutput"><span class="identifier">cpp_dec_float</span><span class="special"><</span><span class="identifier">N</span><span class="special">></span></code> 137 </p> 138 </td> 139<td> 140 <p> 141 boost/multiprecision/cpp_dec_float.hpp 142 </p> 143 </td> 144<td> 145 <p> 146 10 147 </p> 148 </td> 149<td> 150 <p> 151 None 152 </p> 153 </td> 154<td> 155 <p> 156 Header only, all C++ implementation. Boost licence. 157 </p> 158 </td> 159<td> 160 <p> 161 Approximately 2x slower than the <a href="http://www.mpfr.org" target="_top">MPFR</a> 162 or <a href="http://gmplib.org" target="_top">GMP</a> libraries. 163 </p> 164 </td> 165</tr> 166<tr> 167<td> 168 <p> 169 <code class="computeroutput"><span class="identifier">mpf_float</span><span class="special"><</span><span class="identifier">N</span><span class="special">></span></code> 170 </p> 171 </td> 172<td> 173 <p> 174 boost/multiprecision/gmp.hpp 175 </p> 176 </td> 177<td> 178 <p> 179 2 180 </p> 181 </td> 182<td> 183 <p> 184 <a href="http://gmplib.org" target="_top">GMP</a> 185 </p> 186 </td> 187<td> 188 <p> 189 Very fast and efficient back-end. 190 </p> 191 </td> 192<td> 193 <p> 194 Dependency on GNU licensed <a href="http://gmplib.org" target="_top">GMP</a> 195 library. 196 </p> 197 </td> 198</tr> 199<tr> 200<td> 201 <p> 202 <code class="computeroutput"><span class="identifier">mpfr_float</span><span class="special"><</span><span class="identifier">N</span><span class="special">></span></code> 203 </p> 204 </td> 205<td> 206 <p> 207 boost/multiprecision/mpfr.hpp 208 </p> 209 </td> 210<td> 211 <p> 212 2 213 </p> 214 </td> 215<td> 216 <p> 217 <a href="http://gmplib.org" target="_top">GMP</a> and <a href="http://www.mpfr.org" target="_top">MPFR</a> 218 </p> 219 </td> 220<td> 221 <p> 222 Very fast and efficient back-end, with its own standard library 223 implementation. 224 </p> 225 </td> 226<td> 227 <p> 228 Dependency on GNU licensed <a href="http://gmplib.org" target="_top">GMP</a> 229 and <a href="http://www.mpfr.org" target="_top">MPFR</a> libraries. 230 </p> 231 </td> 232</tr> 233<tr> 234<td> 235 <p> 236 <code class="computeroutput"><span class="identifier">float128</span></code> 237 </p> 238 </td> 239<td> 240 <p> 241 boost/multiprecision/float128.hpp 242 </p> 243 </td> 244<td> 245 <p> 246 2 247 </p> 248 </td> 249<td> 250 <p> 251 Either <a href="http://gcc.gnu.org/onlinedocs/libquadmath/" target="_top">libquadmath</a> 252 or the Intel C++ Math library. 253 </p> 254 </td> 255<td> 256 <p> 257 Very fast and efficient back-end for 128-bit floating-point values 258 (113-bit mantissa, equivalent to FORTRAN's QUAD real) 259 </p> 260 </td> 261<td> 262 <p> 263 Depends on the compiler being either recent GCC or Intel C++ versions. 264 </p> 265 </td> 266</tr> 267</tbody> 268</table></div> 269</div> 270<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 271<td align="left"></td> 272<td align="right"><div class="copyright-footer">Copyright © 2002-2020 John 273 Maddock and Christopher Kormanyos<p> 274 Distributed under the Boost Software License, Version 1.0. (See accompanying 275 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>) 276 </p> 277</div></td> 278</tr></table> 279<hr> 280<div class="spirit-nav"> 281<a accesskey="p" href="ints/egs/bitops.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="floats/cpp_bin_float.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 282</div> 283</body> 284</html> 285