1include "test.idp" 2 3cout << functionDEFINITION << "log" << endl; 4real t; 5 6cout << typeDEFINITION << "real" << endl; 7 8real r = 4.2; 9real minf = log(0.); 10real pinf = -log(0.); 11 12t = clock(); 13real resr = log(1.); 14t = clock() - t; 15cout << timeELAPSED << t << endl; 16test(resr == 0.); 17 18t = clock(); 19real rminf = log(0.); 20t = clock() - t; 21cout << timeELAPSED << t << endl; 22test(rminf == minf); 23 24t = clock(); 25real rpinf = log(pinf); 26t = clock() - t; 27cout << timeELAPSED << t << endl; 28test(rpinf == pinf); 29 30cout << typeDEFINITION << "complex" << endl; 31 32complex cpos = 4. + 2.i; 33complex cneg = 4. - 2.i; 34 35t = clock(); 36complex rescpos = log(cpos); 37t = clock() - t; 38cout << timeELAPSED << t << endl; 39test(rescpos == log(abs(cpos)) + 1i * arg(cpos)); 40 41t = clock(); 42complex rescneg = log(cneg); 43t = clock() - t; 44cout << timeELAPSED << t << endl; 45test(rescneg == log(abs(cneg)) + 1i * arg(cneg)); 46