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.

46 lines
990 B

25 years ago
  1. #include <cln/number.h>
  2. #include <cln/io.h>
  3. #include <cln/float.h>
  4. #include <cln/lfloat.h>
  5. #include "float/lfloat/cl_LF.h"
  6. #include <cln/complex.h>
  7. #include <cln/complex_io.h>
  8. #include <cln/real.h>
  9. #include <cln/random.h>
  10. #include <cstdlib>
  11. #include <cstring>
  12. #include <cln/timing.h>
  13. using namespace cln;
  14. #include <iostream>
  15. using namespace std;
  16. int main (int argc, char * argv[])
  17. {
  18. int repetitions = 1;
  19. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  20. repetitions = atoi(argv[2]);
  21. argc -= 2; argv += 2;
  22. }
  23. if (argc < 2)
  24. exit(1);
  25. uintL len = atoi(argv[1]);
  26. #if 0
  27. cl_LF one = cl_I_to_LF(1,len);
  28. cl_F x = scale_float(random_F(one),-1);
  29. cout << x << endl;
  30. #else
  31. cl_F x = sqrt(cl_I_to_LF(2,len))-1;
  32. #endif
  33. cl_N y;
  34. ln(cl_I_to_LF(1000,len+10)); // fill cache
  35. { CL_TIMING;
  36. for (int rep = repetitions; rep > 0; rep--)
  37. { y = atanh(x); }
  38. }
  39. cout << y << endl;
  40. { CL_TIMING;
  41. for (int rep = repetitions; rep > 0; rep--)
  42. { y = ln((1+x)/(1-x))/2; }
  43. }
  44. cout << y << endl;
  45. }