floats.html 9.6 KB

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