File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -62,19 +62,23 @@ class FComplex : public CMSat::Field {
6262
6363 Field& operator *=(const Field& other) override {
6464 const auto & od = dynamic_cast <const FComplex&>(other);
65- std::tie (real,imag) = std::tuple{
66- real*od.real +imag*od.imag ,
67- real*od.imag +imag*od.real };
65+ mpq_class r = real;
66+ mpq_class i = imag;
67+ real = r*od.real +i*od.imag ;
68+ imag = r*od.imag +i*od.real ;
6869 return *this ;
6970 }
7071
7172 Field& operator /=(const Field& other) override {
7273 const auto & od = dynamic_cast <const FComplex&>(other);
73- if (od.real == 0 ) throw std::runtime_error (" Division by zero" );
74- auto div = od.imag *od.imag +od.real *od.real ;
75- std::tie (real,imag) = std::tuple{
76- (real*od.real +imag*od.imag )/div,
77- (imag*od.real -real*od.imag )/div};
74+ if (od.is_zero ()) throw std::runtime_error (" Division by zero" );
75+ mpq_class div = od.imag *od.imag +od.real *od.real ;
76+ mpq_class r = real;
77+ mpq_class i = imag;
78+ real = r*od.real +i*od.imag ;
79+ real /= div;
80+ imag = i*od.real -r*od.imag ;
81+ imag /= div;
7882 return *this ;
7983 }
8084
You can’t perform that action at this time.
0 commit comments