|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66730 - trunk/boost/math/distributions/detail
From: pbristow_at_[hidden]
Date: 2010-11-24 11:51:37
Author: pbristow
Date: 2010-11-24 11:51:36 EST (Wed, 24 Nov 2010)
New Revision: 66730
URL: http://svn.boost.org/trac/boost/changeset/66730
Log:
Added new handling check.
Text files modified:
trunk/boost/math/distributions/detail/common_error_handling.hpp | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
Modified: trunk/boost/math/distributions/detail/common_error_handling.hpp
==============================================================================
--- trunk/boost/math/distributions/detail/common_error_handling.hpp (original)
+++ trunk/boost/math/distributions/detail/common_error_handling.hpp 2010-11-24 11:51:36 EST (Wed, 24 Nov 2010)
@@ -94,7 +94,28 @@
// Note that this test catches both infinity and NaN.
// Some special cases permit x to be infinite, so these must be tested 1st,
// leaving this test to catch any NaNs. see Normal and cauchy for example.
-}
+} // bool check_x
+
+template <class RealType, class Policy>
+inline bool check_x_gt0(
+ const char* function,
+ RealType x,
+ RealType* result,
+ const Policy& pol)
+{
+ if(x <= 0)
+ {
+ *result = policies::raise_domain_error<RealType>(
+ function,
+ "Random variate x is %1%, but must be > 0!", x, pol);
+ return false;
+ }
+
+ return true;
+ // Note that this test catches both infinity and NaN.
+ // Some special cases permit x to be infinite, so these must be tested 1st,
+ // leaving this test to catch any NaNs. See Normal and cauchy for example.
+} // bool check_x_gt0
template <class RealType, class Policy>
inline bool check_positive_x(
Boost-Commit 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