conversion.qbk 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. [library Boost.NumericConversion
  2. [quickbook 1.4]
  3. [authors [Cacciola Carballal, Fernando Luis]]
  4. [copyright 2004-2007 Fernando Luis Cacciola Carballal]
  5. [category numerics]
  6. [id numeric_conversion]
  7. [dirname numeric_conversion]
  8. [purpose
  9. Optimized Policy-based Numeric Conversions
  10. ]
  11. [source-mode c++]
  12. [license
  13. Distributed under the Boost Software License, Version 1.0.
  14. (See accompanying file LICENSE_1_0.txt or copy at
  15. [@http://www.boost.org/LICENSE_1_0.txt])
  16. ]
  17. ]
  18. [/ Macros will be used for links so we have a central place to change them ]
  19. [/ Cited Boost resources ]
  20. [def __MPL_INTEGRAL_CONSTANT__ [@../../../../mpl/doc/refmanual/integral-constant.html MPL's Integral Constant] ]
  21. [/ Other web resources ]
  22. [def __SGI_UNARY_FUNCTION__ [@http://www.sgi.com/tech/stl/UnaryFunction.html Unary Function Object]]
  23. [/ Icons ]
  24. [def __NOTE__ [$images/note.png]]
  25. [def __ALERT__ [$images/caution.png]]
  26. [def __DETAIL__ [$images/note.png]]
  27. [def __TIP__ [$images/tip.png]]
  28. [def __QUESTION_MARK__ [$images/question.png]]
  29. [def __SPACE__ [$images/space.png]]
  30. [def __GO_TO__ [$images/callouts/R.png]]
  31. [section Overview]
  32. The Boost Numeric Conversion library is a collection of tools to describe and
  33. perform conversions between values of different
  34. [link boost_numericconversion.definitions.numeric_types numeric types].
  35. The library includes a special alternative for a subset of `std::numeric_limits<>`,
  36. the [link boost_numericconversion.bounds___traits_class bounds<>] traits class, which provides
  37. a consistent way to obtain the [link boost_numericconversion.definitions.range_and_precision boundary]
  38. values for the [link boost_numericconversion.definitions.range_and_precision range] of a numeric type.
  39. It also includes a set of [link boost_numericconversion.conversion_traits___traits_class trait classes]
  40. which describes the compile-time
  41. properties of a conversion from a source to a target numeric type.
  42. Both [link boost_numericconversion.definitions.c___arithmetic_types arithmetic] and
  43. [link boost_numericconversion.definitions.numeric_types user-defined numeric types] can be used.
  44. A policy-based [link boost_numericconversion.converter___function_object converter] object which
  45. uses `conversion_traits` to select
  46. an optimized implementation is supplied. Such implementation uses an optimal
  47. range checking code suitable for the source/target combination.
  48. * The converter's out-of-range behavior can be customized via an
  49. [link boost_numericconversion.numeric_converter_policy_classes.policy_overflowhandler OverflowHandler] policy.
  50. * For floating-point to integral conversions, the rounding mode can be selected via the
  51. [link boost_numericconversion.numeric_converter_policy_classes.policy_float2introunder Float2IntRounder] policy.
  52. * A custom low-level conversion routine (for UDTs for instance) can be passed via a
  53. [link boost_numericconversion.numeric_converter_policy_classes.policy_rawconverter RawConverter] policy.
  54. * The optimized automatic range-checking logic can be overridden via a
  55. [link boost_numericconversion.numeric_converter_policy_classes.policy_userrangechecker UserRangeChecker] policy.
  56. [endsect]
  57. [include definitions.qbk]
  58. [include converter.qbk]
  59. [include requirements.qbk]
  60. [include bounds.qbk]
  61. [include conversion_traits.qbk]
  62. [include converter_policies.qbk]
  63. [include numeric_cast.qbk]
  64. [section History and Acknowledgments]
  65. [heading Pre-formal review]
  66. * Kevlin Henney, with help from David Abrahams and Beman Dawes, originally contributed
  67. the previous version of `numeric_cast<>` which already presented the idea of a runtime
  68. range check.
  69. * Later, Eric Ford, Kevin Lynch and the author spotted some genericity problems with
  70. that `numeric_cast<>` which prevented it from being used in a generic layer of math
  71. functions.
  72. * An improved `numeric_cast<>` which properly handled all combinations of arithmetic
  73. types was presented.
  74. * David Abrahams and Beman Dawes acknowledged the need of an improved version of
  75. `numeric_cast<>` and supported the submission as originally laid out. Daryl Walker and
  76. Darin Adler made some important comments and proposed fixes to the original submission.
  77. * Special thanks go to Björn Karlsoon who helped the author considerably. Having found the
  78. problems with `numeric_cast<>` himself, he revised very carefully the original submission
  79. and spot a subtle bug in the range checking implementation. He also wrote part of
  80. this documentation and proof-read and corrected other parts. And most importantly:
  81. the features now presented here in this library evolved from the original submission as
  82. a result of the useful private communications between Björn and the author.
  83. [heading Post-formal review]
  84. * Guillaume Melquiond spoted some documentation and code issues, particularly about
  85. rounding conversions.
  86. * The following people contributed an important review of the design, documentation and c
  87. ode: Kevin Lynch, Thorsten Ottosen, Paul Bristow, Daryle Walker, Jhon Torjo, Eric Ford,
  88. Gennadiy Rozental.
  89. [endsect]
  90. [section Bibliography]
  91. * Standard Documents:
  92. # ISO/IEC 14882:98 (C++98 Standard)
  93. # ISO/IEC 9899:1999 (C99 Standard)
  94. # ISO/IEC 10967-1 (Language Independent Arithmetic (LIA), Part I, 1994)
  95. # ISO/IEC 2382-1:1993 (Information Technology - Vocabulary - Part I: Fundamental Terms)
  96. # ANSI/IEEE 754-1985 [and IEC 60559:1989] (Binary floating-point)
  97. # ANSI/IEEE 854-1988 (Radix Independent floating-point)
  98. # ANSI X3/TR-1-82 (Dictionary for Information Processing Systems)
  99. # ISO/IEC JTC1/SC22/WG14/N753 C9X Revision Proposal: LIA-1 Binding: Rationale
  100. * Papers:
  101. # David Goldberg What Every Computer Scientist Should Know About Floating-Point Arithmetic
  102. # Prof. William Kahan papers on floating-point.
  103. [endsect]