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.

43 lines
908 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_complex.h>
  7. #include <cl_complex_io.h>
  8. #include <cl_real.h>
  9. #include <cl_random.h>
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <cl_timing.h>
  13. int main (int argc, char * argv[])
  14. {
  15. int repetitions = 1;
  16. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  17. repetitions = atoi(argv[2]);
  18. argc -= 2; argv += 2;
  19. }
  20. if (argc < 2)
  21. exit(1);
  22. uintL len = atoi(argv[1]);
  23. #if 0
  24. cl_LF one = cl_I_to_LF(1,len);
  25. cl_F x = scale_float(random_F(one),-1);
  26. cout << x << endl;
  27. #else
  28. cl_F x = sqrt(cl_I_to_LF(2,len))-1;
  29. #endif
  30. cl_N y;
  31. ln(cl_I_to_LF(1000,len+10)); // fill cache
  32. { CL_TIMING;
  33. for (int rep = repetitions; rep > 0; rep--)
  34. { y = atanh(x); }
  35. }
  36. cout << y << endl;
  37. { CL_TIMING;
  38. for (int rep = repetitions; rep > 0; rep--)
  39. { y = ln((1+x)/(1-x))/2; }
  40. }
  41. cout << y << endl;
  42. }