Initial commit
This commit is contained in:
155
libs/math/doc/html/math_toolkit/rationale.html
Normal file
155
libs/math/doc/html/math_toolkit/rationale.html
Normal file
@@ -0,0 +1,155 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Rationale</title>
|
||||
<link rel="stylesheet" href="../math.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<link rel="home" href="../index.html" title="Math Toolkit 2.1.0">
|
||||
<link rel="up" href="../cstdfloat.html" title="Chapter 3. Specified-width floating-point typedefs">
|
||||
<link rel="prev" href="overview.html" title="Overview">
|
||||
<link rel="next" href="exact_typdefs.html" title="Exact-Width Floating-Point typedefs">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overview.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../cstdfloat.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="exact_typdefs.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="math_toolkit.rationale"></a><a class="link" href="rationale.html" title="Rationale">Rationale</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
The implementation of <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
is designed to utilize <code class="computeroutput"><span class="special"><</span><span class="keyword">float</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span></code>,
|
||||
defined in the 1989 C standard. The preprocessor is used to query certain preprocessor
|
||||
definitions in <code class="computeroutput"><span class="special"><</span><span class="keyword">float</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span></code>
|
||||
such as FLT_MAX, DBL_MAX, etc. Based on the results of these queries, an attempt
|
||||
is made to automatically detect the presence of built-in floating-point types
|
||||
having specified widths. An unequivocal test regarding conformance with <a href="http://en.wikipedia.org/wiki/IEEE_floating_point" target="_top">IEEE_floating_point</a>
|
||||
(IEC599) based on <a href="http://en.cppreference.com/w/cpp/types/numeric_limits/is_iec559" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><>::</span><span class="identifier">is_iec559</span></code></a>
|
||||
is performed with <code class="computeroutput"><span class="identifier">BOOST_STATIC_ASSERT</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
In addition, this Boost implementation <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
supports an 80-bit floating-point <code class="computeroutput"><span class="keyword">typedef</span></code>
|
||||
if it can be detected, and a 128-bit floating-point <code class="computeroutput"><span class="keyword">typedef</span></code>
|
||||
if it can be detected, provided that the underlying types conform with <a href="http://en.wikipedia.org/wiki/Extended_precision" target="_top">IEEE-754 precision extension</a>
|
||||
(if<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><>::</span><span class="identifier">is_iec559</span></code> is true for this type).
|
||||
</p>
|
||||
<p>
|
||||
The header <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
makes the standardized floating-point <code class="computeroutput"><span class="keyword">typedef</span></code>s
|
||||
safely available in <code class="computeroutput"><span class="keyword">namespace</span> <span class="identifier">boost</span></code> without placing any names in <code class="computeroutput"><span class="keyword">namespace</span> <span class="identifier">std</span></code>.
|
||||
The intention is to complement rather than compete with a potential future
|
||||
C/C++ Standard Library that may contain these <code class="computeroutput"><span class="keyword">typedef</span></code>s.
|
||||
Should some future C/C++ standard include <code class="computeroutput"><span class="special"><</span><span class="identifier">stdfloat</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span></code> and
|
||||
<code class="computeroutput"><span class="special"><</span><span class="identifier">cstdfloat</span><span class="special">></span></code>, then <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
will continue to function, but will become redundant and may be safely deprecated.
|
||||
</p>
|
||||
<p>
|
||||
Because <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
is a Boost header, its name conforms to the boost header naming conventions,
|
||||
not the C++ Standard Library header naming conventions.
|
||||
</p>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>
|
||||
<code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
<span class="bold"><strong>cannot synthesize or create a <code class="computeroutput"><span class="keyword">typedef</span></code>
|
||||
if the underlying type is not provided by the compiler</strong></span>. For example,
|
||||
if a compiler does not have an underlying floating-point type with 128 bits
|
||||
(highly sought-after in scientific and numeric programming), then <code class="computeroutput"><span class="identifier">float128_t</span></code> and its corresponding least
|
||||
and fast types are not provided by <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span></code>>.
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
<div class="warning"><table border="0" summary="Warning">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../doc/src/images/warning.png"></td>
|
||||
<th align="left">Warning</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>
|
||||
If <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
uses a compiler-specific non-standardized type (<span class="bold"><strong>not</strong></span>
|
||||
derived from <code class="computeroutput"><span class="keyword">float</span><span class="special">,</span>
|
||||
<span class="keyword">double</span><span class="special">,</span></code>
|
||||
or <code class="computeroutput"><span class="keyword">long</span> <span class="keyword">double</span></code>)
|
||||
for one or more of its floating-point <code class="computeroutput"><span class="keyword">typedef</span></code>s,
|
||||
then there is no guarantee that specializations of <code class="computeroutput"><span class="identifier">numeric_limits</span><span class="special"><></span></code> will be available for these types.
|
||||
Typically, specializations of <code class="computeroutput"><span class="identifier">numeric_limits</span><span class="special"><></span></code> will only be available for these
|
||||
types if the compiler itself supports corresponding specializations for the
|
||||
underlying type(s), exceptions are GCC's <code class="computeroutput"><span class="identifier">__float128</span></code>
|
||||
type and Intel's <code class="computeroutput"><span class="identifier">_Quad</span></code> type
|
||||
which are explicitly supported via our own code.
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
<div class="warning"><table border="0" summary="Warning">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../doc/src/images/warning.png"></td>
|
||||
<th align="left">Warning</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>
|
||||
As an implementation artifact, certain C macro names from <code class="computeroutput"><span class="special"><</span><span class="keyword">float</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span></code> may possibly be visible to users of
|
||||
<code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
|
||||
Don't rely on using these macros; they are not part of any Boost-specified
|
||||
interface. Use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><></span></code>
|
||||
for floating-point ranges, etc. instead.
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
<div class="tip"><table border="0" summary="Tip">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../doc/src/images/tip.png"></td>
|
||||
<th align="left">Tip</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top">
|
||||
<p>
|
||||
For best results, <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
should be <code class="computeroutput"><span class="preprocessor">#include</span></code>d before
|
||||
other headers that define generic code making use of standard library functions
|
||||
defined in <cmath>.
|
||||
</p>
|
||||
<p>
|
||||
This is because <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
may define overloads of standard library functions where a non-standard type
|
||||
(i.e. other than <code class="computeroutput"><span class="keyword">float</span></code>, <code class="computeroutput"><span class="keyword">double</span></code>, or <code class="computeroutput"><span class="keyword">long</span>
|
||||
<span class="keyword">double</span></code>) is used for one of the specified
|
||||
width types. If generic code (for example in another Boost.Math header) calls
|
||||
a standard library function, then the correct overload will only be found
|
||||
if these overloads are defined prior to the point of use. See implementation
|
||||
for more details.
|
||||
</p>
|
||||
<p>
|
||||
For this reason, making <code class="computeroutput"><span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
the <span class="bold"><strong>first include</strong></span> is usually best.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal,
|
||||
Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
|
||||
Holin, Bruno Lalande, John Maddock, Johan Råde, Gautam Sewani, Benjamin Sobotta,
|
||||
Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overview.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../cstdfloat.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="exact_typdefs.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user