00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00035 #ifndef MISCFUNCTIONS_H
00036 #define MISCFUNCTIONS_H
00037
00038 #include <sstream>
00039 #include <math.h>
00040 #include <string>
00041 #include <errno.h>
00042 #include "invalidcastexception.h"
00043
00045 using namespace std;
00046
00051 #define ROUND_TO_DECIMAL_PLACE 16
00052
00059 #define REPLACE_DECIMAL_POINT_BEFORE true
00060
00067 #define REPLACE_DECIMAL_POINT_AFTER false
00068
00077 class MiscFunctions {
00078
00079 public:
00087 static long double getNumericFromString(const char *str);
00088
00096 static const char *getStringFromNumerical(long double num);
00097
00106 static long double getSummationFrom(long double left, long double right);
00107
00116 static long double getSubtractionFrom(long double left, long double right);
00117
00126 static long double getPowerFrom(long double base, long double exponent);
00127
00136 static long double getRadicalFrom(long double base, long double radix);
00137
00146 static long double getDivisionFrom(long double numerator,
00147 long double denominator);
00148
00157 static long double getRoundFrom(long double num, unsigned places =
00158 ROUND_TO_DECIMAL_PLACE);
00159
00168 static bool needsTrim(const char *s);
00169
00176 static const char *trim(const char *s);
00177 };
00178
00179 #endif // MISCFUNCTIONS_H