Imported Upstream version 1.51.0
[platform/upstream/boost.git] / libs / math / doc / sf_and_dist / html / math_toolkit / utils / fp_facets / rationale.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Design Rationale</title>
5 <link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="../../../index.html" title="Math Toolkit">
8 <link rel="up" href="../fp_facets.html" title="Facets for Floating-Point Infinities and NaNs">
9 <link rel="prev" href="portability.html" title="Portability">
10 <link rel="next" href="../next_float.html" title="Floating-Point Representation Distance (ULP), and Finding Adjacent Floating-Point Values">
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="portability.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_facets.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="../next_float.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section math_toolkit_utils_fp_facets_rationale">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="math_toolkit.utils.fp_facets.rationale"></a><a class="link" href="rationale.html" title="Design Rationale">Design Rationale</a>
28 </h4></div></div></div>
29 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
30 <li class="listitem">
31               The flags are implemented as a const data member of the facet. Facets
32               are reference counted, and locales can share facets. Therefore changing
33               the flags of a facet would have effects that are hard to predict. An
34               alternative design would be to implement the flags using <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">xalloc</span></code> and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">iword</span></code>.
35               Then one could safely modify the flags, and one could define manipulators
36               that do so. However, for that to work with dynamically linked libraries,
37               a <code class="computeroutput"><span class="special">.</span><span class="identifier">cpp</span></code>
38               file would have to be added to the library. It was judged be more desirable
39               to have a headers only library, than to have mutable flags and manipulators.
40             </li>
41 <li class="listitem">
42               The facet <code class="computeroutput"><span class="identifier">nonfinite_num_put</span></code>
43               throws an exception when the <code class="computeroutput"><span class="identifier">trap_infinity</span></code>
44               or <code class="computeroutput"><span class="identifier">trap_nan</span></code> flag is
45               set and an attempt is made to format infinity or NaN. It would be better
46               if the facet set the fail bit of the stream. However, facets derived
47               from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">num_put</span></code> do not have access to the
48               stream state.
49             </li>
50 </ul></div>
51 </div>
52 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
53 <td align="left"></td>
54 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010 John Maddock, Paul A. Bristow, Hubert Holin, Xiaogang Zhang, Bruno
55       Lalande, Johan R&#229;de, Gautam Sewani, Thijs van den Berg and Benjamin Sobotta<p>
56         Distributed under the Boost Software License, Version 1.0. (See accompanying
57         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>)
58       </p>
59 </div></td>
60 </tr></table>
61 <hr>
62 <div class="spirit-nav">
63 <a accesskey="p" href="portability.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_facets.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="../next_float.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
64 </div>
65 </body>
66 </html>