You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.6 KiB

25 years ago
25 years ago
25 years ago
  1. #include <cln/number.h>
  2. #include <cln/io.h>
  3. #include <cln/float.h>
  4. #include <cln/real.h>
  5. #include <cln/random.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <cln/timing.h>
  9. #include "cl_LF.h"
  10. using namespace cln;
  11. int main (int argc, char * argv[])
  12. {
  13. int repetitions = 1;
  14. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  15. repetitions = atoi(argv[2]);
  16. argc -= 2; argv += 2;
  17. }
  18. if (argc < 2)
  19. exit(1);
  20. uintL len = atoi(argv[1]);
  21. extern cl_LF compute_catalanconst_ramanujan (uintC len);
  22. extern cl_LF compute_catalanconst_ramanujan_fast (uintC len);
  23. extern cl_LF compute_catalanconst_expintegral1 (uintC len);
  24. extern cl_LF compute_catalanconst_expintegral2 (uintC len);
  25. extern cl_LF compute_catalanconst_cvz1 (uintC len);
  26. extern cl_LF compute_catalanconst_cvz2 (uintC len);
  27. cl_LF p;
  28. ln(cl_I_to_LF(1000,len+10)); // fill cache
  29. { CL_TIMING;
  30. for (int rep = repetitions; rep > 0; rep--)
  31. { p = compute_catalanconst_ramanujan(len); }
  32. }
  33. cout << p << endl;
  34. { CL_TIMING;
  35. for (int rep = repetitions; rep > 0; rep--)
  36. { p = compute_catalanconst_ramanujan_fast(len); }
  37. }
  38. cout << p << endl;
  39. #if 0
  40. { CL_TIMING;
  41. for (int rep = repetitions; rep > 0; rep--)
  42. { p = compute_catalanconst_expintegral1(len); }
  43. }
  44. cout << p << endl;
  45. { CL_TIMING;
  46. for (int rep = repetitions; rep > 0; rep--)
  47. { p = compute_catalanconst_expintegral2(len); }
  48. }
  49. cout << p << endl;
  50. #endif
  51. { CL_TIMING;
  52. for (int rep = repetitions; rep > 0; rep--)
  53. { p = compute_catalanconst_cvz1(len); }
  54. }
  55. cout << p << endl;
  56. { CL_TIMING;
  57. for (int rep = repetitions; rep > 0; rep--)
  58. { p = compute_catalanconst_cvz2(len); }
  59. }
  60. cout << p << endl;
  61. }