1 | <HTML> |
---|
2 | <HEAD> |
---|
3 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> |
---|
4 | <LINK REL="stylesheet" TYPE="text/css" HREF="../../../../boost.css"> |
---|
5 | <TITLE>Boost Numeric Conversion Library - Index</TITLE> |
---|
6 | </HEAD> |
---|
7 | <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000ff" VLINK="#800080"> |
---|
8 | <TABLE BORDER="0" CELLPADDING="7" CELLSPACING="0" WIDTH="100%" |
---|
9 | SUMMARY="header"> |
---|
10 | <TR> |
---|
11 | <TH VALIGN="top" WIDTH="300"> |
---|
12 | <H3><A HREF="../../../../index.htm"><IMG HEIGHT="86" WIDTH="277" |
---|
13 | ALT="C++ Boost" SRC="../../../../boost.png" BORDER="0"></A></H3> </TH> |
---|
14 | <TH VALIGN="top"> |
---|
15 | <H1 ALIGN="center">Boost Numeric Conversion Library</H1> </TH> |
---|
16 | </TR> |
---|
17 | </TABLE> |
---|
18 | <HR> |
---|
19 | <table border="0" cellpadding="0" width="100%"> |
---|
20 | <tr> |
---|
21 | <td width="50%" valign="top"><font size="4">This Document</font><br><br> |
---|
22 | <a href="#Overview">Overview</a><br> |
---|
23 | <a href="#Ack">History and Acknowledgments</a><br> |
---|
24 | <a href="#Ref">Bibliography</a><br> |
---|
25 | </td> |
---|
26 | <td width="50%"><font size="4">Other Documents</font><br><br> |
---|
27 | <A HREF="definitions.html">Definitions</A><br> |
---|
28 | <A HREF="converter.html"><code>converter<></code> function object</A><br> |
---|
29 | <A HREF="requirements.html">Type Requirements and User-defined-types support</A><br> |
---|
30 | <A HREF="bounds.html"><code>bounds<></code> traits class</A><br> |
---|
31 | <A HREF="conversion_traits.html"><code>conversion_traits<></code> traits class</A><br> |
---|
32 | <A HREF="converter_policies.html">Numeric Converter Policy Classes</A><br> |
---|
33 | <A HREF="numeric_cast.html">Improved numeric_cast<></A><br> |
---|
34 | </td> |
---|
35 | </tr> |
---|
36 | </table> |
---|
37 | |
---|
38 | <hr> |
---|
39 | <H2><A NAME="Overview"></A>Overview</H2> |
---|
40 | <P>The Boost Numeric Conversion library is a collection of tools to describe and perform |
---|
41 | conversions between values of different <a href="definitions.html#numtypes">numeric types</a>.</p> |
---|
42 | <p>The library includes a special alternative for a subset of <code>std::numeric_limits<></code>, |
---|
43 | the <A HREF="bounds.html"><code>bounds<></code></A> traits class, which provides |
---|
44 | a consistent way to obtain the <a href="definitions.html#range">boundary</a> values for the |
---|
45 | <a href="definitions.html#range">range</a> of a numeric type.</p> |
---|
46 | <p>It also includes a set of <A HREF="conversion_traits.html">trait classes</A> which |
---|
47 | describes the compile-time properties of a conversion from a source to a target |
---|
48 | numeric type. Both <a href="definitions.html#stdtypes">arithmetic</a> and <a href="definitions.html#numtypes">user-defined |
---|
49 | numeric types</a> can be used.</p> |
---|
50 | <p>A policy-based <A HREF="converter.html">converter</A> object which uses <code>conversion_traits</code> |
---|
51 | to select an optimized implementation is supplied. |
---|
52 | Such implementation uses an optimal range checking code suitable for the source/target combination.<br> |
---|
53 | The converter's out-of-range behavior can be customized via an <A HREF="converter_policies.html#oh">OverflowHandler</A> |
---|
54 | policy.<br> |
---|
55 | For floating-point to integral conversions, the rounding mode can be selected via |
---|
56 | the <A HREF="converter_policies.html#f2i">Float2IntRounder</A> policy.<br> |
---|
57 | A custom low-level conversion routine (for UDTs for instance) can be passed |
---|
58 | via a <A HREF="converter_policies.html#rawc">RawConverter</A> policy.<br> |
---|
59 | The optimized automatic range-checking logic can be overridden via a <A HREF="converter_policies.html#rc">UserRangeChecker</A> |
---|
60 | policy.</p> |
---|
61 | <hr> |
---|
62 | <H2><A NAME="Ack"></A>History and Acknowledgments</H2> |
---|
63 | <p>Pre-formal review:</p> |
---|
64 | <blockquote> |
---|
65 | <p>Kevlin Henney, with help from David Abrahams and Beman Dawes, originally contributed |
---|
66 | the previous version of numeric_cast<> which already presented the idea of a runtime range check.<br> |
---|
67 | Later, Eric Ford, Kevin Lynch and the author spotted some genericity problems |
---|
68 | with that numeric_cast<> which prevented it from being used in a generic |
---|
69 | layer of math functions.<br> |
---|
70 | An improved numeric_cast<> which properly handled all combinations of arithmetic types was presented.<br> |
---|
71 | David Abrahams and Beman Dawes acknowledged the need of an improved version |
---|
72 | of numeric_cast<> and supported the submission as originally laid out. |
---|
73 | Daryl Walker and Darin Adler made some important comments and proposed fixes |
---|
74 | to the original submission.</p> |
---|
75 | <p>Special thanks go to Björn Karlsoon who helped the author considerably. Having |
---|
76 | found the problems with numeric_cast<> himself, he revised very carefully |
---|
77 | the original submission and spot a subtle bug in the range checking implementation. |
---|
78 | He also wrote part of this documentation and proof-read and corrected other |
---|
79 | parts. And most importantly: the features now presented here in this library |
---|
80 | evolved from the original submission as a result of the useful private communications |
---|
81 | between Björn and the author.</p> |
---|
82 | </blockquote> |
---|
83 | <p>Post-formal review:</p> |
---|
84 | <p>Guillaume Melquiond spoted some documentation and code issues, particularly about rounding conversions.<br> |
---|
85 | The following people contributed an important review of the design, documentation and code: Kevin Lynch, Thorsten Ottosen, Paul Bristow, |
---|
86 | Daryle Walker, Jhon Torjo, Eric Ford, Gennadiy Rozental. |
---|
87 | </p> |
---|
88 | <hr> |
---|
89 | <H2><A NAME="Ref"></A>Bibliography</H2> |
---|
90 | <ul> |
---|
91 | <li>Standard Documents: |
---|
92 | <ol> |
---|
93 | <li>ISO/IEC 14882:98 (C++98 Standard)</li> |
---|
94 | <li>ISO/IEC 9899:1999 (C99 Standard)</li> |
---|
95 | <li>ISO/IEC 10967-1 (Language Independent Arithmetic (LIA), Part I, 1994)</li> |
---|
96 | <li>ISO/IEC 2382-1:1993 (Information Technology - Vocabulary - Part I: Fundamental Terms)</li> |
---|
97 | <li>ANSI/IEEE 754-1985 [and IEC 60559:1989] (Binary floating-point)</li> |
---|
98 | <li>ANSI/IEEE 854-1988 (Radix Independent floating-point)</li> |
---|
99 | <li>ANSI X3/TR-1-82 (Dictionary for Information Processing Systems)</li> |
---|
100 | <li><a href="http://anubis.dkuug.dk/JTC1/SC22/WG14/www/docs/n753.htm">ISO/IEC JTC1/SC22/WG14/N753</a> C9X Revision Proposal: LIA-1 Binding: Rationale</li> |
---|
101 | </ol> |
---|
102 | </li> |
---|
103 | <li>Papers: |
---|
104 | <ol> |
---|
105 | <li>David Goldberg <A href="http://citeseer.ist.psu.edu/goldberg91what.html"> |
---|
106 | What Every Computer Scientist Should Know About Floating-Point Arithmetic</A></li> |
---|
107 | <li><A href="http://www.cs.berkeley.edu/~wkahan/">Prof. William Kahan</A> papers on floating-point.</li> |
---|
108 | </ol> |
---|
109 | </li> |
---|
110 | </ul> |
---|
111 | <HR> |
---|
112 | <P>Revised 23 June 2004</P> |
---|
113 | <p>© Copyright Fernando Luis Cacciola Carballal, 2004</p> |
---|
114 | <p> Use, modification, and distribution are subject to the Boost Software |
---|
115 | License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt"> |
---|
116 | LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> |
---|
117 | www.boost.org/LICENSE_1_0.txt</a>)</p> |
---|
118 | </body> |
---|
119 | </HTML> |
---|