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.

85 lines
2.1 KiB

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 <cstdlib>
  7. #include <cstring>
  8. #include <cln/timing.h>
  9. #include "float/lfloat/cl_LF.h"
  10. namespace cln
  11. {
  12. // FIXME: don't use internal functions.
  13. extern cl_LF compute_eulerconst (uintC len);
  14. extern cl_LF compute_eulerconst_expintegral (uintC len);
  15. extern cl_LF compute_eulerconst_expintegral1 (uintC len);
  16. extern cl_LF compute_eulerconst_expintegral2 (uintC len);
  17. extern cl_LF compute_eulerconst_besselintegral1 (uintC len);
  18. extern cl_LF compute_eulerconst_besselintegral2 (uintC len);
  19. extern cl_LF compute_eulerconst_besselintegral3 (uintC len);
  20. extern cl_LF compute_eulerconst_besselintegral4 (uintC len);
  21. }
  22. using namespace cln;
  23. int main (int argc, char * argv[])
  24. {
  25. int repetitions = 1;
  26. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  27. repetitions = atoi(argv[2]);
  28. argc -= 2; argv += 2;
  29. }
  30. if (argc < 2)
  31. exit(1);
  32. uintL len = atoi(argv[1]);
  33. cl_LF p;
  34. ln(cl_I_to_LF(1000,len+10)); // fill cache
  35. #if 0
  36. { CL_TIMING;
  37. for (int rep = repetitions; rep > 0; rep--)
  38. { p = compute_eulerconst(len); }
  39. }
  40. #else
  41. #if 0
  42. { CL_TIMING;
  43. for (int rep = repetitions; rep > 0; rep--)
  44. { p = compute_eulerconst_expintegral(len); }
  45. }
  46. // cout << p << endl;
  47. { CL_TIMING;
  48. for (int rep = repetitions; rep > 0; rep--)
  49. { p = compute_eulerconst_expintegral1(len); }
  50. }
  51. // cout << p << endl;
  52. { CL_TIMING;
  53. for (int rep = repetitions; rep > 0; rep--)
  54. { p = compute_eulerconst_expintegral2(len); }
  55. }
  56. // cout << p << endl;
  57. #endif
  58. { CL_TIMING;
  59. for (int rep = repetitions; rep > 0; rep--)
  60. { p = compute_eulerconst_besselintegral1(len); }
  61. }
  62. // cout << p << endl;
  63. #if 0
  64. { CL_TIMING;
  65. for (int rep = repetitions; rep > 0; rep--)
  66. { p = compute_eulerconst_besselintegral2(len); }
  67. }
  68. // cout << p << endl;
  69. { CL_TIMING;
  70. for (int rep = repetitions; rep > 0; rep--)
  71. { p = compute_eulerconst_besselintegral3(len); }
  72. }
  73. // cout << p << endl;
  74. #endif
  75. { CL_TIMING;
  76. for (int rep = repetitions; rep > 0; rep--)
  77. { p = compute_eulerconst_besselintegral4(len); }
  78. }
  79. // cout << p << endl;
  80. #endif
  81. }