X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=benchmarks%2Ftimebench1.cc;h=46482a93c0d8b8babfd8f19e11eb41bdeb02e6db;hb=746549dde985f8e7b05fb88d2842962be421c69d;hp=e2bad84a6d5ac0f5d7f2b540da1f7fbe44a529ba;hpb=dd9e0f894eec7e2a8cf85078330ddc0a6639090b;p=cln.git diff --git a/benchmarks/timebench1.cc b/benchmarks/timebench1.cc index e2bad84..46482a9 100644 --- a/benchmarks/timebench1.cc +++ b/benchmarks/timebench1.cc @@ -1,17 +1,20 @@ // Benchmarks from the LiDIA home page -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace cln; +using namespace std; // Timings on Linux i486 33 MHz, 1000 decimal places = 104 32-bit words. // Function LiDIA Pari CLISP CLN @@ -61,42 +64,42 @@ int main (int argc, char * argv[]) if (argc < 1) exit(1); - fprint(cl_stderr, "Number of repetitions: "); - fprintdecimal(cl_stderr, repetitions); - fprint(cl_stderr, "\n"); + fprint(std::cerr, "Number of repetitions: "); + fprintdecimal(std::cerr, repetitions); + fprint(std::cerr, "\n"); - cl_float_format_t prec = cl_float_format(1000); + float_format_t prec = float_format(1000); - fprint(cl_stderr, "pi\n"); + fprint(std::cerr, "pi\n"); { cl_F p; - { CL_TIMING; p = cl_pi(prec); } + { CL_TIMING; p = pi(prec); } { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_F p = cl_pi(prec); } + { cl_F p = pi(prec); } } cout << p << endl << endl; } - fprint(cl_stderr, "gamma\n"); + fprint(std::cerr, "gamma\n"); { cl_F p; - { CL_TIMING; p = cl_eulerconst(prec); } + { CL_TIMING; p = eulerconst(prec); } { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_F p = cl_eulerconst(prec); } + { cl_F p = eulerconst(prec); } } cout << p << endl << endl; } - fprint(cl_stderr, "e\n"); - { cl_F p = cl_exp1(prec); + fprint(std::cerr, "e\n"); + { cl_F p = exp1(prec); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_F p = cl_exp1(prec); } + { cl_F p = exp1(prec); } } cout << p << endl << endl; } - fprint(cl_stderr, "sqrt(3)\n"); + fprint(std::cerr, "sqrt(3)\n"); { cl_R p = sqrt(cl_float(3,prec)); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -105,7 +108,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "exp(log(2))\n"); + fprint(std::cerr, "exp(log(2))\n"); { cl_N p = exp(log(cl_float(2,prec))); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -114,7 +117,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "log(exp(2))\n"); + fprint(std::cerr, "log(exp(2))\n"); { cl_N p = log(exp(cl_float(2,prec))); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -123,25 +126,25 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "sin(pi/3)\n"); - { cl_R p = sin(cl_pi(prec)/3); + fprint(std::cerr, "sin(pi/3)\n"); + { cl_R p = sin(pi(prec)/3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_R p = sin(cl_pi(prec)/3); } + { cl_R p = sin(pi(prec)/3); } } cout << p << endl << endl; } - fprint(cl_stderr, "cos(pi/3)\n"); - { cl_R p = cos(cl_pi(prec)/3); + fprint(std::cerr, "cos(pi/3)\n"); + { cl_R p = cos(pi(prec)/3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_R p = cos(cl_pi(prec)/3); } + { cl_R p = cos(pi(prec)/3); } } cout << p << endl << endl; } - fprint(cl_stderr, "arcsin(sqrt(3)/2)\n"); + fprint(std::cerr, "arcsin(sqrt(3)/2)\n"); { cl_N p = asin(sqrt(cl_float(3,prec))/2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -150,7 +153,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "arccos(sqrt(3)/2)\n"); + fprint(std::cerr, "arccos(sqrt(3)/2)\n"); { cl_N p = acos(sqrt(cl_float(3,prec))/2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -159,7 +162,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "sinh(log(2))\n"); + fprint(std::cerr, "sinh(log(2))\n"); { cl_N p = sinh(log(cl_float(2,prec))); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -168,7 +171,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "cosh(log(2))\n"); + fprint(std::cerr, "cosh(log(2))\n"); { cl_N p = cosh(log(cl_float(2,prec))); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -177,20 +180,20 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "arsinh(pi)\n"); - { cl_N p = asinh(cl_pi(prec)); + fprint(std::cerr, "arsinh(pi)\n"); + { cl_N p = asinh(pi(prec)); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_N p = asinh(cl_pi(prec)); } + { cl_N p = asinh(pi(prec)); } } cout << p << endl << endl; } - fprint(cl_stderr, "arcosh(pi)\n"); - { cl_N p = acosh(cl_pi(prec)); + fprint(std::cerr, "arcosh(pi)\n"); + { cl_N p = acosh(pi(prec)); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_N p = acosh(cl_pi(prec)); } + { cl_N p = acosh(pi(prec)); } } cout << p << endl << endl; }