mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-03 06:12:43 -06:00
Core: Complex - support for conversion from number values, polyequal support
git-svn-id: svn://ultimatepp.org/upp/trunk@3624 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
682d88d2c6
commit
99c5bc6351
1 changed files with 5 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ struct Complex : std::complex<double>
|
|||
|
||||
Complex(const Nuller&) : C(DOUBLE_NULL) {}
|
||||
operator Value() const { return RichValue<Complex>(*this); }
|
||||
Complex(const Value& v) : C(RichValue<Complex>::Extract(v)) {}
|
||||
Complex(const Value& v) : C(IsNumber(v) ? C((double)v) : RichValue<Complex>::Extract(v)) {}
|
||||
|
||||
bool operator==(const Complex& c) const { return (const C&)(*this) == (const C&)c; }
|
||||
bool operator!=(const Complex& c) const { return (const C&)(*this) != (const C&)c; }
|
||||
|
|
@ -34,5 +34,9 @@ template<> inline dword ValueTypeNo(const Complex*) { return COMPLEX_V; }
|
|||
|
||||
inline const Complex& Nvl(const Complex& a, const Complex& b) { return IsNull(a) ? b : a; }
|
||||
|
||||
inline bool IsPolyEqual(const Complex& x, const Value& v) {
|
||||
return IsNumber(v) && x.imag() == 0 && x.real() == (double)v;
|
||||
}
|
||||
|
||||
VALUE_COMPARE(Complex)
|
||||
NTL_MOVEABLE(Complex)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue