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.

45 lines
932 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 < 3)
  19. exit(1);
  20. extern double cl_atanx_factor;
  21. extern int cl_atan_algo;
  22. uintL len = atoi(argv[1]);
  23. cl_atanx_factor = atof(argv[2]);
  24. #if 0
  25. cl_LF one = cl_I_to_LF(1,len);
  26. cl_F x = scale_float(random_F(one),-1);
  27. cout << x << endl;
  28. #else
  29. cl_F x = sqrt(cl_I_to_LF(2,len))-1;
  30. #endif
  31. cl_F y;
  32. cl_atan_algo = 0;
  33. { CL_TIMING;
  34. for (int rep = repetitions; rep > 0; rep--)
  35. { y = atan(x); }
  36. }
  37. cout << y << endl;
  38. cl_atan_algo = 1;
  39. { CL_TIMING;
  40. for (int rep = repetitions; rep > 0; rep--)
  41. { y = atan(x); }
  42. }
  43. cout << y << endl;
  44. }