diff --git a/uppsrc/Core/Core.h b/uppsrc/Core/Core.h index 230ef88..74f54a2 100644 --- a/uppsrc/Core/Core.h +++ b/uppsrc/Core/Core.h @@ -168,6 +168,7 @@ #include #include +#include // fix MSC8 beta problem.... #ifdef COMPILER_MSC diff --git a/uppsrc/Core/Defs.h b/uppsrc/Core/Defs.h index e41e407..34767ff 100644 --- a/uppsrc/Core/Defs.h +++ b/uppsrc/Core/Defs.h @@ -247,6 +247,8 @@ typedef long long unsigned uint64; typedef uint64 qword; +typedef std::complex cdouble; + #ifdef COMPILER_MSC #define I64(c) ((int64)COMBINE(c, i64)) #else diff --git a/uppsrc/Core/Stream.cpp b/uppsrc/Core/Stream.cpp index d2eddd0..95bb29d 100644 --- a/uppsrc/Core/Stream.cpp +++ b/uppsrc/Core/Stream.cpp @@ -670,6 +670,13 @@ Stream& Stream::operator%(uint64& d) return *this; } +Stream& Stream::operator%(cdouble& d) { + double r,i; + if(IsStoring()) { r = d.real(); i = d.imag(); } + (*this) % r % i; + if(IsLoading()) { d = cdouble(r,i); } + return *this; +} Stream& Stream::operator%(String& s) { if(IsError()) return *this; diff --git a/uppsrc/Core/Stream.h b/uppsrc/Core/Stream.h index 11b31d2..e1f41e9 100644 --- a/uppsrc/Core/Stream.h +++ b/uppsrc/Core/Stream.h @@ -204,6 +204,7 @@ public: Stream& operator%(double& d); Stream& operator%(int64& d); Stream& operator%(uint64& d); + Stream& operator%(cdouble& d); Stream& operator%(String& s); Stream& operator/(String& s); diff --git a/uppsrc/Core/String.h b/uppsrc/Core/String.h index ab03d05..48f26ff 100644 --- a/uppsrc/Core/String.h +++ b/uppsrc/Core/String.h @@ -781,6 +781,7 @@ template<> inline String AsString(const char& a) { return String(a, 1 template<> inline String AsString(const signed char& a) { return String(a, 1); } template<> inline String AsString(const unsigned char& a) { return String(a, 1); } template<> inline String AsString(const bool& a) { return a ? "true" : "false"; } +template<> inline String AsString(const cdouble& x) { return String().Cat() << "C(" << x.real() << "," << x.imag() << ")"; } unsigned ctoi(int c); diff --git a/uppsrc/Core/Topt.h b/uppsrc/Core/Topt.h index eda7cda..da3c17c 100644 --- a/uppsrc/Core/Topt.h +++ b/uppsrc/Core/Topt.h @@ -391,6 +391,7 @@ template<> inline unsigned GetHashValue(const wchar_t& a) { return (const template<> inline unsigned GetHashValue(const int64& a) { return CombineHash((unsigned)a, (unsigned)(a >> 32)); } template<> inline unsigned GetHashValue(const uint64& a) { return GetHashValue((int64)a); } +template<> inline unsigned GetHashValue(const cdouble& x) { return CombineHash(x.real(), x.imag()); } unsigned GetHashValue0(const double& a); diff --git a/uppsrc/Core/Value.cpp b/uppsrc/Core/Value.cpp index 314d658..2226afb 100644 --- a/uppsrc/Core/Value.cpp +++ b/uppsrc/Core/Value.cpp @@ -58,6 +58,7 @@ Value::Value(double d) { ptr = new RichValueRep(d); } Value::Value(bool b) { ptr = new RichValueRep(b); } Value::Value(Date d) { ptr = new RichValueRep(d); } Value::Value(Time t) { ptr = new RichValueRep