//*********************************************************** // // NXV4 "Math-on-Paper" software // // package : CPX class _____________________________________ // // supports: move semantix // operators + - * / ^ L,R-val context // += -= *= /= // fabs() // phi () [ 0 ... 2.pi] o/p // phi2() [-pi ... +pi] o/p // ~ - unary operators L,R-val // cpx i.e. int // float // double // long double // type_casts between the types // cout << overload // // TOTAL = 27+1205 instantiated op/f's // _____________________________________ // // // authors : Mihai-Tiberiu Dima (1) // Maria Dima (2) // // Meshcheryakov Laboratory of Information Techn. // Joint Institute for Nuclear Research // Dubna-Russia // // on leave from: // // Hyperion Univ. Bucharest-Romania // // // date : CPX4/v1.0.alfa / Mon Dec 27 17:13:57 CET 2021 // v2.1.beta / Mon Mar 07 12:45:54 CET 2022 // //*********************************************************** #include #include #include #include "cpx.hh" using namespace std ; using namespace cpx4 ; int main() { // this is a print example, using cout // // the switch "setprecision" is used in the normal way // as for any other scalars // // to use this example do the following: // rm test.cc // ln -s e4.cc test.cc // make test // make run using dblx = double ; using real = long double ; double e = exp(1) ; double pi = 3.14159265853 ; cpx i__int(0,1) ; cpx i_dblx(0,1) ; cpx i_real(0,1) ; int u__int = 1 ; dblx u_dblx = 1 ; int u_real = 1 ; auto z = pi + i__int ; cout << endl ; cout << endl ; cout << " _____________________________________" << endl ; cout << endl ; cout << setprecision(3) << " " << pi << " (double scalar) + " << i__int << " = " << z << " (auto)" << endl ; cout << " _____________________________________" << endl ; cout << endl ; cout << endl ; cout << endl ; }