
BoostCommit : 
Subject: [Boostcommit] svn:boost r50856  sandbox/SOC/2007/visualization/boost/svg_plot/detail
From: pbristow_at_[hidden]
Date: 20090128 13:05:59
Author: pbristow
Date: 20090128 13:05:59 EST (Wed, 28 Jan 2009)
New Revision: 50856
URL: http://svn.boost.org/trac/boost/changeset/50856
Log:
More doxygenation.
Text files modified:
sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp  63 ++++++++++++++++++++
1 files changed, 33 insertions(+), 30 deletions()
Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp
==============================================================================
 sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp 20090128 13:05:59 EST (Wed, 28 Jan 2009)
@@ 26,13 +26,15 @@
template<typename FPT> class smallest;
enum floating_point_comparison_type
{ //! enum floating_point_comparison_type Two types of floatingpoint comparison "Very close" and "Close enough".
 FPC_STRONG, // "Very close"  Knuth equation 1' the default.
 FPC_WEAK // "Close enough"  equation 2'.
 // equations in Dougles E. Knuth, Seminumerical algorithms (3rd Ed) section 4.2.4, Vol II,
 // pp 213225, AddisonWesley, 1997, ISBN: 0201896842.
 // Strong requires closeness relative to BOTH values begin compared,
 // Weak only requires only closeness to EITHER ONE value.
+{ /*! \enum floating_point_comparison_type
+ \brief Two types of floatingpoint comparison "Very close" and "Close enough".
+ \details equations in Dougles E. Knuth, Seminumerical algorithms (3rd Ed) section 4.2.4, Vol II,
+ pp 213225, AddisonWesley, 1997, ISBN: 0201896842.
+ Strong requires closeness relative to BOTH values begin compared,
+ Weak only requires only closeness to EITHER ONE value.
+ */
+ FPC_STRONG, //!< "Very close"  Knuth equation 1 (the default).
+ FPC_WEAK //!< "Close enough"  Knuth equation 2.
};
// GNU int gsl_fcmp (double x, double y, double epsilon) provides similar function.
@@ 81,7 +83,7 @@
template<typename FPT = double>
class close_to
{ //! Test if two floatingpoint values are close within a chosen tolerance.
+{ //! \brief Test if two floatingpoint values are close within a chosen tolerance.
public:
// One constructor for fraction tolerance only. (Percent is NOT implemented).
template<typename FPT>
@@ 132,23 +134,22 @@
}; // class close_to
/* \details
 Check floatingpoint value is smaller than a chosen small value.
 David Monniaux, http://arxiv.org/abs/cs/0701192v4,
 It is somewhat common for beginners to add a comparison check to 0 before
 computing a division, in order to avoid possible divisionbyzero exceptions or
 the generation of infinite results. A first objection to this practise is that, anyway,
 computing 1/x for x very close to zero will generate very large numbers
 that will most probably result in overflows later.
 Another objection, which few programmers know about and that we wish to draw attention
 to, is that it may actually fail to work, depending on what the compiler
 does — that is, the program may actually test that x == 0, then, further down,
 find that x = 0 without any apparent change to x!
 */

template<typename FPT = double>
class smallest
{
+{ //! \brief Check floatingpoint value is smaller than a chosen small value.
+ /* \details
+ David Monniaux, http://arxiv.org/abs/cs/0701192v4,
+ It is somewhat common for beginners to add a comparison check to 0 before
+ computing a division, in order to avoid possible divisionbyzero exceptions or
+ the generation of infinite results. A first objection to this practise is that, anyway,
+ computing 1/x for x very close to zero will generate very large numbers
+ that will most probably result in overflows later.
+ Another objection, which few programmers know about and that we wish to draw attention
+ to, is that it may actually fail to work, depending on what the compiler
+ does — that is, the program may actually test that x == 0, then, further down,
+ find that x = 0 without any apparent change to x!
+ */
+
public:
template<typename FPT>
explicit smallest(FPT s)
@@ 203,12 +204,14 @@
// Define two convenience typedefs.
// Since double and the default smallest value 2 * min_value = 4.45015e308
// is a very common requirement, provide an convenience alias for this:
typedef smallest<double> tiny; //! Allow tiny as a shorthand for 1e308.

// Since double and the default smallest value 2 * min_value = 4.45015e308
// is a very common requirement, provide an convenience alias for this:
typedef close_to<double> neareq; //! Allow tiny as a shorthand for epsilon.
+/*! \details Since double and the default smallest value 2 * std::numeric_limits<double>::min_value() = 2 * 2.22507e308 + 4.45015e308
+ is a very common requirement, provide an convenience alias for this.
+*/
+typedef smallest<double> tiny; //!< Allow tiny as a shorthand for 4.45e308.
+
+/*! \details Since double and the default close_to value 2 * epsilon = std::numeric_limits<double>::epsilon = 2 * 2.220446e016 = 4.440892e016
+ is a very common requirement, provide an convenience alias for this.
+*/
+typedef close_to<double> neareq; //!< Allow neareq as a shorthand for 4.44e16
#endif // BOOST_FLOATING_POINT_COMPARISON_HPP
BoostCommit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk