00001 #ifndef QMCGRCOMP_H
00002 #define QMCGRCOMP_H
00003
00004 #include <iostream>
00005 #include <math.h>
00006 #include "IeeeMath.h"
00007
00008 using namespace std;
00009
00045 class QMCDouble
00046 {
00047 public:
00048
00052 QMCDouble();
00053
00058 QMCDouble(double k);
00059
00067 QMCDouble(double k, double a, double b, double c);
00068
00074 QMCDouble( const QMCDouble & rhs );
00075
00079 ~QMCDouble();
00080
00086 QMCDouble & divideBy(const QMCDouble &denom);
00087
00092 QMCDouble & multiplyBy(const QMCDouble &rhs);
00093
00098 QMCDouble & add(const QMCDouble &rhs);
00099
00100
00101 QMCDouble operator + ( const QMCDouble & rhs ) const;
00102 QMCDouble operator - ( const QMCDouble & rhs ) const;
00103 QMCDouble operator * ( const QMCDouble & rhs ) const;
00104 QMCDouble operator / ( const QMCDouble & rhs ) const;
00105 void operator += ( const QMCDouble & rhs );
00106 void operator -= ( const QMCDouble & rhs );
00107 void operator *= ( const QMCDouble & rhs );
00108 void operator /= ( const QMCDouble & rhs );
00109 void operator = ( const QMCDouble & rhs );
00110
00111 QMCDouble operator + ( const double & rhs ) const;
00112 QMCDouble operator - ( const double & rhs ) const;
00113 QMCDouble operator * ( const double & rhs ) const;
00114 QMCDouble operator / ( const double & rhs ) const;
00115 void operator += ( const double & rhs );
00116 void operator -= ( const double & rhs );
00117 void operator *= ( const double & rhs );
00118 void operator /= ( const double & rhs );
00119 void operator = ( double rhs );
00120
00126 operator double() const;
00127
00132 void toXML(ostream & strm);
00133
00134
00135
00136
00137 friend ostream& operator << (ostream& strm, const QMCDouble & rhs);
00138
00143 double getValue() const;
00144
00149 bool isNotValid() const;
00150
00154 bool isZero() const;
00155
00156 private:
00157
00161 double k,a,b,c;
00162
00166 void initialize();
00167
00171 void SimplifyRatioPowers(double na, double nb, double da, double db,
00172 double &ra, double &rb);
00173 };
00174
00175 #endif
00176