sf_performance_poly.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ///////////////////////////////////////////////////////////////
  2. // Copyright 2011 John Maddock. Distributed under the Boost
  3. // Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
  5. #include "sf_performance.hpp"
  6. void poly_tests()
  7. {
  8. //
  9. // 50 digits first:
  10. //
  11. std::cout << "Testing Polynomial Evaluation at 50 digits....." << std::endl;
  12. #if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
  13. mpfr_set_default_prec(50 * 1000L / 301L);
  14. #endif
  15. #ifdef TEST_MPREAL
  16. mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
  17. #endif
  18. #ifdef TEST_MPFR
  19. time_proc("mpfr_float_50", test_polynomial<mpfr_float_50>);
  20. time_proc("mpfr_float_50 (no expression templates", test_polynomial<number<mpfr_float_backend<50>, et_off> >);
  21. time_proc("static_mpfr_float_50", test_polynomial<static_mpfr_float_50>);
  22. #endif
  23. #ifdef TEST_MPF
  24. time_proc("mpf_float_50", test_polynomial<mpf_float_50>);
  25. time_proc("mpf_float_50 (no expression templates", test_polynomial<number<gmp_float<50>, et_off> >);
  26. #endif
  27. #ifdef TEST_CPP_DEC_FLOAT
  28. time_proc("cpp_dec_float_50", test_polynomial<cpp_dec_float_50>);
  29. #endif
  30. #ifdef TEST_CPP_BIN_FLOAT
  31. time_proc("cpp_bin_float_50", test_polynomial<cpp_bin_float_50>);
  32. #endif
  33. #ifdef TEST_MPFR_CLASS
  34. time_proc("mpfr_class", test_polynomial<mpfr_class>);
  35. #endif
  36. #ifdef TEST_MPREAL
  37. time_proc("mpfr::mpreal", test_polynomial<mpfr::mpreal>);
  38. #endif
  39. //
  40. // Then 100 digits:
  41. //
  42. std::cout << "Testing Polynomial Evaluation at 100 digits....." << std::endl;
  43. #ifdef TEST_MPFR_CLASS
  44. mpfr_set_default_prec(100 * 1000L / 301L);
  45. #endif
  46. #ifdef TEST_MPREAL
  47. mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
  48. #endif
  49. #ifdef TEST_MPFR
  50. time_proc("mpfr_float_100", test_polynomial<mpfr_float_100>);
  51. time_proc("mpfr_float_100 (no expression templates", test_polynomial<number<mpfr_float_backend<100>, et_off> >);
  52. time_proc("static_mpfr_float_100", test_polynomial<static_mpfr_float_100>);
  53. #endif
  54. #ifdef TEST_MPF
  55. time_proc("mpf_float_100", test_polynomial<mpf_float_100>);
  56. time_proc("mpf_float_100 (no expression templates", test_polynomial<number<gmp_float<100>, et_off> >);
  57. #endif
  58. #ifdef TEST_CPP_DEC_FLOAT
  59. time_proc("cpp_dec_float_100", test_polynomial<cpp_dec_float_100>);
  60. #endif
  61. #ifdef TEST_CPP_BIN_FLOAT
  62. time_proc("cpp_bin_float_100", test_polynomial<cpp_bin_float_100>);
  63. #endif
  64. #ifdef TEST_MPFR_CLASS
  65. time_proc("mpfr_class", test_polynomial<mpfr_class>);
  66. #endif
  67. #ifdef TEST_MPREAL
  68. time_proc("mpfr::mpreal", test_polynomial<mpfr::mpreal>);
  69. #endif
  70. }