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.

78 lines
2.0 KiB

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 <cstdlib>
  7. #include <cstring>
  8. #include <cln/timing.h>
  9. #include "float/lfloat/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_eulerconst (uintC len);
  22. extern cl_LF compute_eulerconst_expintegral (uintC len);
  23. extern cl_LF compute_eulerconst_expintegral1 (uintC len);
  24. extern cl_LF compute_eulerconst_expintegral2 (uintC len);
  25. extern cl_LF compute_eulerconst_besselintegral1 (uintC len);
  26. extern cl_LF compute_eulerconst_besselintegral2 (uintC len);
  27. extern cl_LF compute_eulerconst_besselintegral3 (uintC len);
  28. extern cl_LF compute_eulerconst_besselintegral4 (uintC len);
  29. cl_LF p;
  30. ln(cl_I_to_LF(1000,len+10)); // fill cache
  31. #if 0
  32. { CL_TIMING;
  33. for (int rep = repetitions; rep > 0; rep--)
  34. { p = compute_eulerconst(len); }
  35. }
  36. #else
  37. #if 0
  38. { CL_TIMING;
  39. for (int rep = repetitions; rep > 0; rep--)
  40. { p = compute_eulerconst_expintegral(len); }
  41. }
  42. // cout << p << endl;
  43. { CL_TIMING;
  44. for (int rep = repetitions; rep > 0; rep--)
  45. { p = compute_eulerconst_expintegral1(len); }
  46. }
  47. // cout << p << endl;
  48. { CL_TIMING;
  49. for (int rep = repetitions; rep > 0; rep--)
  50. { p = compute_eulerconst_expintegral2(len); }
  51. }
  52. // cout << p << endl;
  53. #endif
  54. { CL_TIMING;
  55. for (int rep = repetitions; rep > 0; rep--)
  56. { p = compute_eulerconst_besselintegral1(len); }
  57. }
  58. // cout << p << endl;
  59. #if 0
  60. { CL_TIMING;
  61. for (int rep = repetitions; rep > 0; rep--)
  62. { p = compute_eulerconst_besselintegral2(len); }
  63. }
  64. // cout << p << endl;
  65. { CL_TIMING;
  66. for (int rep = repetitions; rep > 0; rep--)
  67. { p = compute_eulerconst_besselintegral3(len); }
  68. }
  69. // cout << p << endl;
  70. #endif
  71. { CL_TIMING;
  72. for (int rep = repetitions; rep > 0; rep--)
  73. { p = compute_eulerconst_besselintegral4(len); }
  74. }
  75. // cout << p << endl;
  76. #endif
  77. }