Complex Number 0.1.2 |
00001 // Copyright (c) 2010 Matthew Krupcale 00002 00003 // Permission is hereby granted, free of charge, to any person 00004 // obtaining a copy of this software and associated documentation 00005 // files (the "Software"), to deal in the Software without 00006 // restriction, including without limitation the rights to use, 00007 // copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 // copies of the Software, and to permit persons to whom the 00009 // Software is furnished to do so, subject to the following 00010 // conditions: 00011 00012 // The above copyright notice and this permission notice shall be 00013 // included in all copies or substantial portions of the Software. 00014 00015 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00016 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 00017 // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00018 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 00019 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 00020 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00021 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00022 // OTHER DEALINGS IN THE SOFTWARE. 00023 00024 #ifndef MATH_EXCEPTIONS_H 00025 #define MATH_EXCEPTIONS_H 00026 00027 //============================================================================ 00028 // Name : MathExceptions.h 00029 // Author : Matthew Krupcale 00030 // Version : 0.1.0 00031 // Copyright : Copyright (C) 2010 Matthew Krupcale 00032 // Description : A set of mathematical exceptions 00033 //============================================================================ 00034 00046 #include "Namespace.h" 00047 #include <exception> 00048 00056 BEGIN_NAMESPACE(math) 00057 00058 00065 BEGIN_NAMESPACE(complex) 00066 00074 class DivisionByZeroException : public std::exception { 00075 const char* what() const throw() { 00076 return "Error: Divide by zero."; 00077 } 00078 }; 00079 00087 class LogarithmOfZeroException : public std::exception { 00088 const char* what() const throw() { 00089 return "Error: Logarithm of zero."; 00090 } 00091 }; 00092 00100 class ZeroToComplexPowerException : public std::exception { 00101 const char* what() const throw() { 00102 return "Error: Zero to a complex power."; 00103 } 00104 }; 00105 00113 class ZeroToTheZerothPowerException : public std::exception { 00114 const char* what() const throw() { 00115 return "Error: Zero to the zeroth power."; 00116 } 00117 }; 00118 00119 END_NAMESPACE(complex) 00120 END_NAMESPACE(math) 00121 00122 #endif /* MATH_EXCEPTIONS_H */