-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomplex.cpp
More file actions
39 lines (32 loc) · 857 Bytes
/
complex.cpp
File metadata and controls
39 lines (32 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "complex.hpp"
#include <iostream>
extern int precision;
Complex::Complex()
{
i.set_prec(precision);
r.set_prec(precision);
}
Complex::Complex(const mpf_class &r, const mpf_class &i): r(r), i(i)
{
}
//int Complex::Square(Complex &pout, const Complex &p1, mpf_class &tmpBuf)
//{
////std::cout << "p1 " << p1.r << " + " << p1.i << "i" << std::endl;
////std::cout << "p2 " << p2.r << " + " << p2.i << "i" << std::endl;
//tmpBuf = pout.r = p1.r * p1.r;
//pout.i = p1.i * p1.i;
//tmpBuf += pout.i;
//if(4 < tmpBuf)
//return 1;
//pout.r -= pout.i;
//tmpBuf = p1.r * p1.i;
//pout.i = tmpBuf + tmpBuf;
////std::cout << "pout " << pout.r << " + " << pout.i << "i" << std::endl;
//return 0;
//}
//Complex &Complex::operator+=(const Complex &other)
//{
//this->r += other.r;
//this->i += other.i;
//return *this;
//}