#include #include #include #include int precision = 8; const int zmaxsize=51; const int cmaxsize=5; int qqq; #include "genprec.h" #include "cgenprec.h" complexmp a,b,c,h; //declare five complex numbers realmp cc,hh,aa; complexmp vec[cmaxsizepad],vec2[cmaxsizepad]; float ar,ai; main() {zsuppi(); //need these for trig operations zsupe(); //need these two for log and exp operations zsuplogsp(); unsigned int i; for (i=0;i<11;i++) {a=i; //this is i,0 printmp(a); //Note that the printing of complex numbers } //is not pretty. That is because the real part //may occupy several lines (when the number of //significant figures is say 400) and that would //followed by the imaginary part occupying several //lines. There is just no way to devise a pretty //printout of multi-precision complex numbers. //In all likelihood, one will not be //printing multi-precision numbers, whether real //or complex, but rather them to float and printing the //abbreviated result, in which case one will //be use the standard print facilities of C++ to //devise one's own print routine. zmessage="a=i for i=0 to 10"; zbreak(); a=2; //this is 2,0 for (i=0;i<11;i++) {b=a*i; printmp(b); } zmessage="b=2*i"; zbreak(); for (i=0;i<11;i++) {b=a/i; printmp(b); } zmessage="b=2/i"; zbreak(); for (i=0;i<11;i++) {b=i*a; printmp(b); } zmessage="b=i*2"; zbreak(); for (i=0;i<11;i++) {b=i/a; printmp(b); } zmessage="b=i/2"; zbreak(); int j; for (j=-5;j<6;j++) {a=j; //this is j,0 printmp(a); } zmessage="a=j"; zbreak(); a=2; //this is 2,0 for (j=-5;j<6;j++) //hmmmm {b=a*j; printmp(b); } zmessage="b=2*j"; zbreak(); for (j=-5;j<6;j++) {b=a/j; printmp(b); } zmessage="b=2/j"; zbreak(); for (j=-5;j<6;j++) {b=j*a; printmp(b); } zmessage="b=j*2"; zbreak(); for (j=-5;j<6;j++) {b=j/a; printmp(b); } zmessage="b=j/2"; zbreak(); a=cfloattomp(1.5E00,2.5E00); cout<<"result of a=cfloattomp(1.5E00,2.5E00)"<<'\n'; printmp(a); b=a+1; cout<<"result of b=a+1"<<'\n'; printmp(b); b=1+a; cout<<"result of b=1+a"<<'\n'; printmp(b); ar=zconmptof(realpartof(a)); ai=zconmptof(imaginarypartof(a)); cout<<"the real and imaginary parts of a in float"<<'\n'; cout<