diff options
author | Chuck Miller <shadowmil@gmail.com> | 2010-06-21 13:12:27 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2010-06-21 13:16:56 -0400 |
commit | 3697be69b0dffc185c9b4cf8221c782f48546771 (patch) | |
tree | d7446a76f046de6d1e1d0239ebccf9d4ba8f5b39 /src/tool/moneycount/portability_exceptions.hpp | |
parent | 14655f336082a85eaafaae8f54f9a5d9a2c6f061 (diff) | |
download | tmwa-3697be69b0dffc185c9b4cf8221c782f48546771.tar.gz tmwa-3697be69b0dffc185c9b4cf8221c782f48546771.tar.bz2 tmwa-3697be69b0dffc185c9b4cf8221c782f48546771.tar.xz tmwa-3697be69b0dffc185c9b4cf8221c782f48546771.zip |
Use the stlplus::inf class in the money count to avoid overflow
Also changed the degree of freedom to 0
Diffstat (limited to 'src/tool/moneycount/portability_exceptions.hpp')
-rw-r--r-- | src/tool/moneycount/portability_exceptions.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tool/moneycount/portability_exceptions.hpp b/src/tool/moneycount/portability_exceptions.hpp new file mode 100644 index 0000000..c66b7bf --- /dev/null +++ b/src/tool/moneycount/portability_exceptions.hpp @@ -0,0 +1,33 @@ +#ifndef STLPLUS_PORTABILITY_EXCEPTIONS
+#define STLPLUS_PORTABILITY_EXCEPTIONS
+////////////////////////////////////////////////////////////////////////////////
+
+// Author: Andy Rushton
+// Copyright: (c) Southampton University 1999-2004
+// (c) Andy Rushton 2004-2009
+// License: BSD License, see ../docs/license.html
+
+// Adds missing arithmetic exceptions used in this library but missing from std
+
+////////////////////////////////////////////////////////////////////////////////
+#include "portability_fixes.hpp"
+#include <string>
+#include <stdexcept>
+
+namespace stlplus
+{
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // thrown by division when the divisor is zero
+ // This is a subclass of std::logic_error so can be caught by a generic catch clause for the superclass
+
+ class divide_by_zero : public std::logic_error {
+ public:
+ divide_by_zero (const std::string& what_arg): std::logic_error (what_arg) { }
+ };
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // end namespace stlplus
+
+#endif
|