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.

44 lines
881 B

25 years ago
  1. #include <cl_number.h>
  2. #include <cl_io.h>
  3. #include <cl_float.h>
  4. #include <cl_lfloat.h>
  5. #include "cl_LF.h"
  6. #include <cl_real.h>
  7. #include <cl_random.h>
  8. #include <stdlib.h>
  9. #include <string.h>
  10. #include <cl_timing.h>
  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. #if 0
  22. cl_LF one = cl_I_to_LF(1,len);
  23. cl_F x = one + random_F(one)/3;
  24. cout << x << endl;
  25. #else
  26. cl_F x = sqrt(sqrt(cl_I_to_LF(2,len)));
  27. #endif
  28. cl_F y;
  29. extern int cl_lnx_algo;
  30. cl_lnx_algo = 0;
  31. y = ln(x); // fill cache
  32. { CL_TIMING;
  33. for (int rep = repetitions; rep > 0; rep--)
  34. { y = ln(x); }
  35. }
  36. cout << y << endl;
  37. cl_lnx_algo = 1;
  38. { CL_TIMING;
  39. for (int rep = repetitions; rep > 0; rep--)
  40. { y = ln(x); }
  41. }
  42. cout << y << endl;
  43. }