|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78472 - in branches/release: boost/math boost/math/bindings boost/math/bindings/detail boost/math/concepts boost/math/constants boost/math/distributions boost/math/distributions/detail boost/math/policies boost/math/special_functions boost/math/special_functions/detail boost/math/tools libs/math libs/math/build libs/math/doc/sf_and_dist libs/math/doc/sf_and_dist/distributions libs/math/doc/sf_and_dist/equations libs/math/doc/sf_and_dist/graphs libs/math/doc/sf_and_dist/html libs/math/example libs/math/test libs/math/test/compile_test
From: john_at_[hidden]
Date: 2012-05-14 13:01:52
Author: johnmaddock
Date: 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
New Revision: 78472
URL: http://svn.boost.org/trac/boost/changeset/78472
Log:
Merge changes from Boost.Math to release.
New constants code, new Hankel and owens_t special functions, new skew normal distribution.
Updated docs.
Added:
branches/release/boost/math/constants/calculate_constants.hpp
- copied unchanged from r78471, /trunk/boost/math/constants/calculate_constants.hpp
branches/release/boost/math/constants/generate.hpp
- copied unchanged from r78471, /trunk/boost/math/constants/generate.hpp
branches/release/boost/math/constants/info.hpp
- copied unchanged from r78471, /trunk/boost/math/constants/info.hpp
branches/release/boost/math/distributions/skew_normal.hpp
- copied unchanged from r78471, /trunk/boost/math/distributions/skew_normal.hpp
branches/release/boost/math/special_functions/hankel.hpp
- copied unchanged from r78471, /trunk/boost/math/special_functions/hankel.hpp
branches/release/boost/math/special_functions/owens_t.hpp
- copied unchanged from r78471, /trunk/boost/math/special_functions/owens_t.hpp
branches/release/libs/math/doc/sf_and_dist/distributions/skew_normal.qbk
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/distributions/skew_normal.qbk
branches/release/libs/math/doc/sf_and_dist/equations/beta1.svg.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/beta1.svg.svg
branches/release/libs/math/doc/sf_and_dist/equations/hankel1.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel1.mml
branches/release/libs/math/doc/sf_and_dist/equations/hankel1.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel1.png
branches/release/libs/math/doc/sf_and_dist/equations/hankel1.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel1.svg
branches/release/libs/math/doc/sf_and_dist/equations/hankel2.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel2.mml
branches/release/libs/math/doc/sf_and_dist/equations/hankel2.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel2.png
branches/release/libs/math/doc/sf_and_dist/equations/hankel2.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel2.svg
branches/release/libs/math/doc/sf_and_dist/equations/hankel3.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel3.mml
branches/release/libs/math/doc/sf_and_dist/equations/hankel3.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel3.png
branches/release/libs/math/doc/sf_and_dist/equations/hankel3.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel3.svg
branches/release/libs/math/doc/sf_and_dist/equations/hankel4.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel4.mml
branches/release/libs/math/doc/sf_and_dist/equations/hankel4.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel4.png
branches/release/libs/math/doc/sf_and_dist/equations/hankel4.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel4.svg
branches/release/libs/math/doc/sf_and_dist/equations/hankel5.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel5.mml
branches/release/libs/math/doc/sf_and_dist/equations/hankel5.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel5.png
branches/release/libs/math/doc/sf_and_dist/equations/hankel5.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/hankel5.svg
branches/release/libs/math/doc/sf_and_dist/equations/normal01_cdf.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/normal01_cdf.mml
branches/release/libs/math/doc/sf_and_dist/equations/normal01_cdf.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/normal01_cdf.png
branches/release/libs/math/doc/sf_and_dist/equations/normal01_cdf.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/normal01_cdf.svg
branches/release/libs/math/doc/sf_and_dist/equations/normal01_pdf.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/normal01_pdf.mml
branches/release/libs/math/doc/sf_and_dist/equations/normal01_pdf.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/normal01_pdf.png
branches/release/libs/math/doc/sf_and_dist/equations/normal01_pdf.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/normal01_pdf.svg
branches/release/libs/math/doc/sf_and_dist/equations/normal_cdf.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/normal_cdf.mml
branches/release/libs/math/doc/sf_and_dist/equations/normal_cdf.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/normal_cdf.png
branches/release/libs/math/doc/sf_and_dist/equations/normal_cdf.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/normal_cdf.svg
branches/release/libs/math/doc/sf_and_dist/equations/owens_t.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/owens_t.mml
branches/release/libs/math/doc/sf_and_dist/equations/owens_t.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/owens_t.png
branches/release/libs/math/doc/sf_and_dist/equations/owens_t.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/owens_t.svg
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_cdf.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_cdf.mml
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_cdf.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_cdf.png
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_cdf.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_cdf.svg
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_kurt_ex.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_kurt_ex.mml
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_kurt_ex.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_kurt_ex.png
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_kurt_ex.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_kurt_ex.svg
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_mean.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_mean.mml
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_mean.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_mean.png
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_mean.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_mean.svg
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_pdf.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_pdf.mml
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_pdf.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_pdf.png
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_pdf.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_pdf.svg
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_pdf0.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_pdf0.mml
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_pdf0.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_pdf0.png
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_pdf0.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_pdf0.svg
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_skewness.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_skewness.mml
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_skewness.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_skewness.png
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_skewness.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_skewness.svg
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_variance.mml
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_variance.mml
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_variance.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_variance.png
branches/release/libs/math/doc/sf_and_dist/equations/skew_normal_variance.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/equations/skew_normal_variance.svg
branches/release/libs/math/doc/sf_and_dist/graphs/owens_integration_area.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/graphs/owens_integration_area.png
branches/release/libs/math/doc/sf_and_dist/graphs/owens_integration_area.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/graphs/owens_integration_area.svg
branches/release/libs/math/doc/sf_and_dist/graphs/plot_owens_3d_xyp.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/graphs/plot_owens_3d_xyp.png
branches/release/libs/math/doc/sf_and_dist/graphs/plot_owens_t.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/graphs/plot_owens_t.png
branches/release/libs/math/doc/sf_and_dist/graphs/skew_normal_cdf.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/graphs/skew_normal_cdf.png
branches/release/libs/math/doc/sf_and_dist/graphs/skew_normal_cdf.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/graphs/skew_normal_cdf.svg
branches/release/libs/math/doc/sf_and_dist/graphs/skew_normal_pdf.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/graphs/skew_normal_pdf.png
branches/release/libs/math/doc/sf_and_dist/graphs/skew_normal_pdf.svg
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/graphs/skew_normal_pdf.svg
branches/release/libs/math/doc/sf_and_dist/hankel.qbk
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/hankel.qbk
branches/release/libs/math/doc/sf_and_dist/html/
- copied from r78469, /trunk/libs/math/doc/sf_and_dist/html/
branches/release/libs/math/doc/sf_and_dist/owens_t.qbk
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/owens_t.qbk
branches/release/libs/math/doc/sf_and_dist/plot_owens_3d_xyp.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/plot_owens_3d_xyp.png
branches/release/libs/math/doc/sf_and_dist/plot_owens_t.png
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/plot_owens_t.png
branches/release/libs/math/doc/sf_and_dist/pp_pi.hpp
- copied unchanged from r78469, /trunk/libs/math/doc/sf_and_dist/pp_pi.hpp
branches/release/libs/math/example/nonfinite_num_facet_trap.cpp
- copied unchanged from r78469, /trunk/libs/math/example/nonfinite_num_facet_trap.cpp
branches/release/libs/math/example/owens_t_example.cpp
- copied unchanged from r78469, /trunk/libs/math/example/owens_t_example.cpp
branches/release/libs/math/example/skew_normal_example.cpp
- copied unchanged from r78469, /trunk/libs/math/example/skew_normal_example.cpp
branches/release/libs/math/test/owens_t.ipp
- copied unchanged from r78469, /trunk/libs/math/test/owens_t.ipp
branches/release/libs/math/test/owens_t_T7.hpp
- copied unchanged from r78469, /trunk/libs/math/test/owens_t_T7.hpp
branches/release/libs/math/test/owens_t_large_data.ipp
- copied unchanged from r78469, /trunk/libs/math/test/owens_t_large_data.ipp
branches/release/libs/math/test/table_type.hpp
- copied unchanged from r78469, /trunk/libs/math/test/table_type.hpp
branches/release/libs/math/test/test_constant_generate.cpp
- copied unchanged from r78469, /trunk/libs/math/test/test_constant_generate.cpp
branches/release/libs/math/test/test_hankel.cpp
- copied unchanged from r78469, /trunk/libs/math/test/test_hankel.cpp
branches/release/libs/math/test/test_nonfinite_io.cpp
- copied unchanged from r78469, /trunk/libs/math/test/test_nonfinite_io.cpp
branches/release/libs/math/test/test_owens_t.cpp
- copied unchanged from r78469, /trunk/libs/math/test/test_owens_t.cpp
branches/release/libs/math/test/test_print_info_on_type.cpp
- copied unchanged from r78469, /trunk/libs/math/test/test_print_info_on_type.cpp
branches/release/libs/math/test/test_skew_normal.cpp
- copied unchanged from r78469, /trunk/libs/math/test/test_skew_normal.cpp
Properties modified:
branches/release/boost/math/ (props changed)
branches/release/libs/math/ (props changed)
branches/release/libs/math/doc/sf_and_dist/faq.qbk (props changed)
branches/release/libs/math/test/s_.ipp (props changed)
Text files modified:
branches/release/boost/math/bindings/detail/big_lanczos.hpp | 11
branches/release/boost/math/bindings/e_float.hpp | 5
branches/release/boost/math/bindings/mpfr.hpp | 6
branches/release/boost/math/bindings/rr.hpp | 11
branches/release/boost/math/concepts/real_concept.hpp | 7
branches/release/boost/math/concepts/real_type_concept.hpp | 1
branches/release/boost/math/concepts/std_real_concept.hpp | 7
branches/release/boost/math/constants/constants.hpp | 281 ++++++++++++-
branches/release/boost/math/distributions/detail/inv_discrete_quantile.hpp | 10
branches/release/boost/math/distributions/triangular.hpp | 2
branches/release/boost/math/policies/error_handling.hpp | 34 +
branches/release/boost/math/special_functions.hpp | 2
branches/release/boost/math/special_functions/detail/bessel_i0.hpp | 30 +
branches/release/boost/math/special_functions/detail/bessel_i1.hpp | 31 +
branches/release/boost/math/special_functions/detail/bessel_j0.hpp | 30 +
branches/release/boost/math/special_functions/detail/bessel_j1.hpp | 30 +
branches/release/boost/math/special_functions/detail/bessel_jy.hpp | 16
branches/release/boost/math/special_functions/detail/bessel_k0.hpp | 30 +
branches/release/boost/math/special_functions/detail/bessel_k1.hpp | 30 +
branches/release/boost/math/special_functions/detail/bessel_y0.hpp | 30 +
branches/release/boost/math/special_functions/detail/bessel_y1.hpp | 30 +
branches/release/boost/math/special_functions/detail/erf_inv.hpp | 40 ++
branches/release/boost/math/special_functions/detail/iconv.hpp | 2
branches/release/boost/math/special_functions/detail/igamma_large.hpp | 1
branches/release/boost/math/special_functions/detail/lanczos_sse2.hpp | 5
branches/release/boost/math/special_functions/detail/lgamma_small.hpp | 8
branches/release/boost/math/special_functions/digamma.hpp | 28 +
branches/release/boost/math/special_functions/erf.hpp | 57 ++
branches/release/boost/math/special_functions/expint.hpp | 92 ++++
branches/release/boost/math/special_functions/expm1.hpp | 43 +-
branches/release/boost/math/special_functions/gamma.hpp | 108 +++++
branches/release/boost/math/special_functions/lanczos.hpp | 55 ++
branches/release/boost/math/special_functions/log1p.hpp | 31 +
branches/release/boost/math/special_functions/math_fwd.hpp | 52 ++
branches/release/boost/math/special_functions/nonfinite_num_facets.hpp | 157 +++++--
branches/release/boost/math/special_functions/round.hpp | 2
branches/release/boost/math/special_functions/trunc.hpp | 2
branches/release/boost/math/special_functions/zeta.hpp | 47 ++
branches/release/boost/math/tools/big_constant.hpp | 20
branches/release/boost/math/tools/config.hpp | 11
branches/release/boost/math/tools/precision.hpp | 4
branches/release/boost/math/tools/test.hpp | 68 +++
branches/release/boost/math/tools/test_data.hpp | 4
branches/release/boost/math/tr1.hpp | 2
branches/release/libs/math/build/Jamfile.v2 | 6
branches/release/libs/math/doc/sf_and_dist/constants.qbk | 757 +++++++++++++++++++++++++++++++++++---
branches/release/libs/math/doc/sf_and_dist/credits.qbk | 2
branches/release/libs/math/doc/sf_and_dist/dist_reference.qbk | 1
branches/release/libs/math/doc/sf_and_dist/distributions/normal.qbk | 14
branches/release/libs/math/doc/sf_and_dist/fp_facets.qbk | 16
branches/release/libs/math/doc/sf_and_dist/graphs/dist_graphs.cpp | 24 +
branches/release/libs/math/doc/sf_and_dist/html4_symbols.qbk | 12
branches/release/libs/math/doc/sf_and_dist/implementation.qbk | 9
branches/release/libs/math/doc/sf_and_dist/index.idx | 9
branches/release/libs/math/doc/sf_and_dist/issues.qbk | 12
branches/release/libs/math/doc/sf_and_dist/math.qbk | 36 +
branches/release/libs/math/doc/sf_and_dist/overview.qbk | 2
branches/release/libs/math/doc/sf_and_dist/roadmap.qbk | 15
branches/release/libs/math/doc/sf_and_dist/structure.qbk | 120 ++++-
branches/release/libs/math/doc/sf_and_dist/thread_safety.qbk | 23
branches/release/libs/math/example/Jamfile.v2 | 3
branches/release/libs/math/example/nonfinite_facet_simple.cpp | 12
branches/release/libs/math/test/Jamfile.v2 | 44 +
branches/release/libs/math/test/acosh_data.ipp | 4
branches/release/libs/math/test/asinh_data.ipp | 4
branches/release/libs/math/test/assoc_legendre_p.ipp | 2
branches/release/libs/math/test/atanh_data.ipp | 4
branches/release/libs/math/test/bessel_i_data.ipp | 2
branches/release/libs/math/test/bessel_i_int_data.ipp | 2
branches/release/libs/math/test/bessel_j_data.ipp | 2
branches/release/libs/math/test/bessel_j_int_data.ipp | 2
branches/release/libs/math/test/bessel_j_large_data.ipp | 2
branches/release/libs/math/test/bessel_k_data.ipp | 2
branches/release/libs/math/test/bessel_k_int_data.ipp | 2
branches/release/libs/math/test/bessel_y01_data.ipp | 2
branches/release/libs/math/test/bessel_yn_data.ipp | 2
branches/release/libs/math/test/bessel_yv_data.ipp | 2
branches/release/libs/math/test/beta_exp_data.ipp | 2
branches/release/libs/math/test/beta_med_data.ipp | 2
branches/release/libs/math/test/beta_small_data.ipp | 2
branches/release/libs/math/test/binomial_data.ipp | 2
branches/release/libs/math/test/binomial_large_data.ipp | 2
branches/release/libs/math/test/binomial_quantile.ipp | 2
branches/release/libs/math/test/cbrt_data.ipp | 2
branches/release/libs/math/test/compile_test/instantiate.hpp | 39 ++
branches/release/libs/math/test/complex_test.cpp | 9
branches/release/libs/math/test/digamma_data.ipp | 2
branches/release/libs/math/test/digamma_neg_data.ipp | 2
branches/release/libs/math/test/digamma_root_data.ipp | 2
branches/release/libs/math/test/digamma_small_data.ipp | 2
branches/release/libs/math/test/ellint_e2_data.ipp | 2
branches/release/libs/math/test/ellint_e_data.ipp | 2
branches/release/libs/math/test/ellint_f_data.ipp | 2
branches/release/libs/math/test/ellint_k_data.ipp | 2
branches/release/libs/math/test/ellint_pi2_data.ipp | 2
branches/release/libs/math/test/ellint_pi3_data.ipp | 2
branches/release/libs/math/test/ellint_pi3_large_data.ipp | 2
branches/release/libs/math/test/ellint_rc_data.ipp | 2
branches/release/libs/math/test/ellint_rd_data.ipp | 2
branches/release/libs/math/test/ellint_rf_data.ipp | 2
branches/release/libs/math/test/ellint_rj_data.ipp | 2
branches/release/libs/math/test/erf_data.ipp | 2
branches/release/libs/math/test/erf_inv_data.ipp | 2
branches/release/libs/math/test/erf_large_data.ipp | 2
branches/release/libs/math/test/erf_small_data.ipp | 2
branches/release/libs/math/test/erfc_inv_big_data.ipp | 2
branches/release/libs/math/test/erfc_inv_data.ipp | 2
branches/release/libs/math/test/expint_1_data.ipp | 2
branches/release/libs/math/test/expint_data.ipp | 2
branches/release/libs/math/test/expint_small_data.ipp | 2
branches/release/libs/math/test/expinti_data.ipp | 2
branches/release/libs/math/test/expinti_data_double.ipp | 2
branches/release/libs/math/test/expinti_data_long.ipp | 2
branches/release/libs/math/test/functor.hpp | 100 ++--
branches/release/libs/math/test/gamma_inv_big_data.ipp | 2
branches/release/libs/math/test/gamma_inv_data.ipp | 2
branches/release/libs/math/test/gamma_inv_small_data.ipp | 2
branches/release/libs/math/test/hermite.ipp | 2
branches/release/libs/math/test/hypergeometric_dist_data2.ipp | 2
branches/release/libs/math/test/hypergeometric_test_data.ipp | 2
branches/release/libs/math/test/ibeta_data.ipp | 2
branches/release/libs/math/test/ibeta_int_data.ipp | 2
branches/release/libs/math/test/ibeta_inv_data.ipp | 2
branches/release/libs/math/test/ibeta_inva_data.ipp | 2
branches/release/libs/math/test/ibeta_large_data.ipp | 2
branches/release/libs/math/test/ibeta_small_data.ipp | 2
branches/release/libs/math/test/igamma_big_data.ipp | 2
branches/release/libs/math/test/igamma_int_data.ipp | 2
branches/release/libs/math/test/igamma_med_data.ipp | 2
branches/release/libs/math/test/igamma_small_data.ipp | 2
branches/release/libs/math/test/laguerre2.ipp | 2
branches/release/libs/math/test/laguerre3.ipp | 2
branches/release/libs/math/test/legendre_p.ipp | 2
branches/release/libs/math/test/legendre_p_large.ipp | 2
branches/release/libs/math/test/log1p_expm1_data.ipp | 4
branches/release/libs/math/test/log1p_expm1_test.hpp | 19
branches/release/libs/math/test/ncbeta.ipp | 4
branches/release/libs/math/test/ncbeta_big.ipp | 4
branches/release/libs/math/test/nccs.ipp | 4
branches/release/libs/math/test/nccs_big.ipp | 4
branches/release/libs/math/test/nct.ipp | 7
branches/release/libs/math/test/negative_binomial_quantile.ipp | 4
branches/release/libs/math/test/pch.hpp | 7
branches/release/libs/math/test/poisson_quantile.ipp | 4
branches/release/libs/math/test/pow_test.cpp | 10
branches/release/libs/math/test/powm1_sqrtp1m1_test.hpp | 19
branches/release/libs/math/test/sph_bessel_data.ipp | 2
branches/release/libs/math/test/sph_neumann_data.ipp | 2
branches/release/libs/math/test/spherical_harmonic.ipp | 4
branches/release/libs/math/test/test_bessel_i.cpp | 7
branches/release/libs/math/test/test_bessel_i.hpp | 69 +-
branches/release/libs/math/test/test_bessel_j.cpp | 10
branches/release/libs/math/test/test_bessel_j.hpp | 116 +++--
branches/release/libs/math/test/test_bessel_k.cpp | 7
branches/release/libs/math/test/test_bessel_k.hpp | 63 +-
branches/release/libs/math/test/test_bessel_y.cpp | 22
branches/release/libs/math/test/test_bessel_y.hpp | 80 ++-
branches/release/libs/math/test/test_beta.hpp | 25
branches/release/libs/math/test/test_binomial.cpp | 9
branches/release/libs/math/test/test_binomial_coeff.hpp | 16
branches/release/libs/math/test/test_carlson.hpp | 57 +-
branches/release/libs/math/test/test_cbrt.hpp | 26
branches/release/libs/math/test/test_chi_squared.cpp | 2
branches/release/libs/math/test/test_constants.cpp | 776 +++++++++++++++++++++++++++++++++++++--
branches/release/libs/math/test/test_digamma.hpp | 21
branches/release/libs/math/test/test_ellint_1.hpp | 43 +-
branches/release/libs/math/test/test_ellint_2.hpp | 57 +-
branches/release/libs/math/test/test_ellint_3.hpp | 47 +-
branches/release/libs/math/test/test_erf.hpp | 63 +-
branches/release/libs/math/test/test_expint.cpp | 16
branches/release/libs/math/test/test_expint.hpp | 47 +-
branches/release/libs/math/test/test_gamma.cpp | 25 +
branches/release/libs/math/test/test_gamma.hpp | 55 +-
branches/release/libs/math/test/test_gamma_data.ipp | 14
branches/release/libs/math/test/test_gamma_dist.cpp | 2
branches/release/libs/math/test/test_hermite.hpp | 15
branches/release/libs/math/test/test_hypergeometric_dist.cpp | 37 +
branches/release/libs/math/test/test_ibeta.cpp | 17
branches/release/libs/math/test/test_ibeta.hpp | 45 +-
branches/release/libs/math/test/test_ibeta_inv.cpp | 8
branches/release/libs/math/test/test_ibeta_inv.hpp | 67 +-
branches/release/libs/math/test/test_ibeta_inv_ab.hpp | 95 ++--
branches/release/libs/math/test/test_igamma.cpp | 34 +
branches/release/libs/math/test/test_igamma.hpp | 53 +-
branches/release/libs/math/test/test_igamma_inv.hpp | 89 ++--
branches/release/libs/math/test/test_igamma_inva.hpp | 76 +-
branches/release/libs/math/test/test_instantiate1.cpp | 2
branches/release/libs/math/test/test_instantiate2.cpp | 2
branches/release/libs/math/test/test_inv_hyp.cpp | 47 +-
branches/release/libs/math/test/test_inverse_chi_squared_distribution.cpp | 2
branches/release/libs/math/test/test_inverse_gamma_distribution.cpp | 2
branches/release/libs/math/test/test_inverse_gaussian.cpp | 2
branches/release/libs/math/test/test_laguerre.cpp | 8
branches/release/libs/math/test/test_laguerre.hpp | 27
branches/release/libs/math/test/test_legendre.hpp | 47 +-
branches/release/libs/math/test/test_long_double_support.cpp | 20
branches/release/libs/math/test/test_nc_beta.cpp | 33
branches/release/libs/math/test/test_nc_chi_squared.cpp | 41 +-
branches/release/libs/math/test/test_nc_t.cpp | 29
branches/release/libs/math/test/test_negative_binomial.cpp | 3
branches/release/libs/math/test/test_nonfinite_trap.cpp | 16
branches/release/libs/math/test/test_poisson.cpp | 5
branches/release/libs/math/test/test_roots.cpp | 45 +-
branches/release/libs/math/test/test_sign.cpp | 4
branches/release/libs/math/test/test_signed_zero.cpp | 248 ++++++++++-
branches/release/libs/math/test/test_spherical_harmonic.cpp | 39 +
branches/release/libs/math/test/test_tgamma_ratio.hpp | 42 +-
branches/release/libs/math/test/test_zeta.hpp | 27
branches/release/libs/math/test/tgamma_delta_ratio_data.ipp | 2
branches/release/libs/math/test/tgamma_delta_ratio_int.ipp | 2
branches/release/libs/math/test/tgamma_delta_ratio_int2.ipp | 2
branches/release/libs/math/test/tgamma_ratio_data.ipp | 2
branches/release/libs/math/test/zeta_1_below_data.ipp | 2
branches/release/libs/math/test/zeta_1_up_data.ipp | 2
branches/release/libs/math/test/zeta_data.ipp | 2
branches/release/libs/math/test/zeta_neg_data.ipp | 2
216 files changed, 4480 insertions(+), 1416 deletions(-)
Modified: branches/release/boost/math/bindings/detail/big_lanczos.hpp
==============================================================================
--- branches/release/boost/math/bindings/detail/big_lanczos.hpp (original)
+++ branches/release/boost/math/bindings/detail/big_lanczos.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -32,6 +32,7 @@
template <class T>
static T lanczos_sum(const T& z)
{
+ lanczos_initializer<lanczos22UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[22] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 46198410803245094237463011094.12173081986)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 43735859291852324413622037436.321513777)),
@@ -86,6 +87,7 @@
template <class T>
static T lanczos_sum_expG_scaled(const T& z)
{
+ lanczos_initializer<lanczos22UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[22] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 6939996264376682180.277485395074954356211)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 6570067992110214451.87201438870245659384)),
@@ -141,6 +143,7 @@
template<class T>
static T lanczos_sum_near_1(const T& dz)
{
+ lanczos_initializer<lanczos22UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[21] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 8.318998691953337183034781139546384476554)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, -63.15415991415959158214140353299240638675)),
@@ -219,6 +222,7 @@
template <class T>
static T lanczos_sum(const T& z)
{
+ lanczos_initializer<lanczos31UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[31] = {
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 0.2579646553333513328235723061836959833277e46)),
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 0.2444796504337453845497419271639377138264e46)),
@@ -291,6 +295,7 @@
template <class T>
static T lanczos_sum_expG_scaled(const T& z)
{
+ lanczos_initializer<lanczos31UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[31] = {
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 30137154810677525966583148469478.52374216)),
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 28561746428637727032849890123131.36314653)),
@@ -364,6 +369,7 @@
template<class T>
static T lanczos_sum_near_1(const T& dz)
{
+ lanczos_initializer<lanczos31UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[30] = {
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 11.80038544942943603508206880307972596807)),
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, -130.6355975335626214564236363322099481079)),
@@ -407,6 +413,7 @@
template<class T>
static T lanczos_sum_near_2(const T& dz)
{
+ lanczos_initializer<lanczos31UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[30] = {
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 147.9979641587472136175636384176549713358)),
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, -1638.404318611773924210055619836375434296)),
@@ -461,6 +468,7 @@
template <class T>
static T lanczos_sum(const T& z)
{
+ lanczos_initializer<lanczos61UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
using namespace boost;
static const T d[61] = {
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 2.50662827463100050241576528481104525300698674060993831662992357634229365460784197494659584)),
@@ -536,6 +544,7 @@
template <class T>
static T lanczos_sum_expG_scaled(const T& z)
{
+ lanczos_initializer<lanczos61UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
using namespace boost;
static const T d[61] = {
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 0.901751806425638853077358552989167785490911341809902155556127108480303870921448984935411583e-27)),
@@ -611,6 +620,7 @@
template<class T>
static T lanczos_sum_near_1(const T& dz)
{
+ lanczos_initializer<lanczos61UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
using namespace boost;
static const T d[60] = {
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 23.2463658527729692390378860713647146932236940604550445351214987229819352880524561852919518)),
@@ -685,6 +695,7 @@
template<class T>
static T lanczos_sum_near_2(const T& dz)
{
+ lanczos_initializer<lanczos61UDT, T>::force_instantiate(); // Ensure our constants get initialized before main()
using namespace boost;
static const T d[60] = {
static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 150, 557.56438192770795764344217888434355281097193198928944200046501607026919782564033547346298)),
Modified: branches/release/boost/math/bindings/e_float.hpp
==============================================================================
--- branches/release/boost/math/bindings/e_float.hpp (original)
+++ branches/release/boost/math/bindings/e_float.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -318,6 +318,11 @@
return ::ef::atan(v.value());
}
+inline e_float atan2(const e_float& v, const e_float& u)
+{
+ return ::ef::atan2(v.value(), u.value());
+}
+
inline e_float ldexp(const e_float& v, int e)
{
return v.value() * ::ef::pow2(e);
Modified: branches/release/boost/math/bindings/mpfr.hpp
==============================================================================
--- branches/release/boost/math/bindings/mpfr.hpp (original)
+++ branches/release/boost/math/bindings/mpfr.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -860,7 +860,11 @@
} // namespace detail
-}}
+}
+
+template<> struct is_convertible<long double, mpfr_class> : public mpl::false_{};
+
+}
#endif // BOOST_MATH_MPLFR_BINDINGS_HPP
Modified: branches/release/boost/math/bindings/rr.hpp
==============================================================================
--- branches/release/boost/math/bindings/rr.hpp (original)
+++ branches/release/boost/math/bindings/rr.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -763,6 +763,17 @@
NTL::RR::precision());
}
+ inline RR atan2(RR y, RR x)
+ {
+ if(x > 0)
+ return atan(y / x);
+ if(x < 0)
+ {
+ return y < 0 ? atan(y / x) - boost::math::constants::pi<RR>() : atan(y / x) + boost::math::constants::pi<RR>();
+ }
+ return y < 0 ? -boost::math::constants::half_pi<RR>() : boost::math::constants::half_pi<RR>() ;
+ }
+
inline RR sinh(RR z)
{
return (expm1(z.value()) - expm1(-z.value())) / 2;
Modified: branches/release/boost/math/concepts/real_concept.hpp
==============================================================================
--- branches/release/boost/math/concepts/real_concept.hpp (original)
+++ branches/release/boost/math/concepts/real_concept.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -28,6 +28,7 @@
#include <boost/math/special_functions/round.hpp>
#include <boost/math/special_functions/trunc.hpp>
#include <boost/math/special_functions/modf.hpp>
+#include <boost/math/tools/big_constant.hpp>
#include <boost/math/tools/precision.hpp>
#include <boost/math/policies/policy.hpp>
#if defined(__SGI_STL_PORT)
@@ -324,6 +325,12 @@
{
template <>
+inline concepts::real_concept make_big_value<concepts::real_concept>(long double val, const char* , mpl::false_ const&, mpl::false_ const&)
+{
+ return val; // Can't use lexical_cast here, sometimes it fails....
+}
+
+template <>
inline concepts::real_concept max_value<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
return max_value<concepts::real_concept_base_type>();
Modified: branches/release/boost/math/concepts/real_type_concept.hpp
==============================================================================
--- branches/release/boost/math/concepts/real_type_concept.hpp (original)
+++ branches/release/boost/math/concepts/real_type_concept.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -6,6 +6,7 @@
#ifndef BOOST_MATH_REAL_TYPE_CONCEPT_HPP
#define BOOST_MATH_REAL_TYPE_CONCEPT_HPP
+#include <boost/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4100)
Modified: branches/release/boost/math/concepts/std_real_concept.hpp
==============================================================================
--- branches/release/boost/math/concepts/std_real_concept.hpp (original)
+++ branches/release/boost/math/concepts/std_real_concept.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -323,12 +323,19 @@
}}
#include <boost/math/tools/precision.hpp>
+#include <boost/math/tools/big_constant.hpp>
namespace boost{ namespace math{
namespace tools
{
template <>
+inline concepts::std_real_concept make_big_value<concepts::std_real_concept>(long double val, const char* , mpl::false_ const&, mpl::false_ const&)
+{
+ return val; // Can't use lexical_cast here, sometimes it fails....
+}
+
+template <>
inline concepts::std_real_concept max_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return max_value<concepts::std_real_concept_base_type>();
Modified: branches/release/boost/math/constants/constants.hpp
==============================================================================
--- branches/release/boost/math/constants/constants.hpp (original)
+++ branches/release/boost/math/constants/constants.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,5 +1,5 @@
-// Copyright John Maddock 2005-2006.
-// Copyright Paul A. Bristow 2006-2010.
+// Copyright John Maddock 2005-2006, 2011.
+// Copyright Paul A. Bristow 2006-2011.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -8,6 +8,8 @@
#define BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED
#include <boost/math/tools/config.hpp>
+#include <boost/math/policies/policy.hpp>
+#include <boost/math/tools/precision.hpp>
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4127 4701)
@@ -16,6 +18,10 @@
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/type_traits/is_convertible.hpp>
namespace boost{ namespace math
{
@@ -35,43 +41,252 @@
// (This is necessary because you can't use a numeric constant
// since even a long double might not have enough digits).
+ enum construction_method
+ {
+ construct_from_float = 1,
+ construct_from_double = 2,
+ construct_from_long_double = 3,
+ construct_from_string = 4
+ };
- #define BOOST_DEFINE_MATH_CONSTANT(name, x, y, exp)\
- template <class T> inline T name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))\
+ //
+ // Max number of binary digits in the string representations
+ // of our constants:
+ //
+ BOOST_STATIC_CONSTANT(int, max_string_digits = (101 * 1000L) / 301L);
+
+ template <class Real, class Policy>
+ struct construction_traits
+ {
+ private:
+ typedef typename policies::precision<Real, Policy>::type t1;
+ typedef typename policies::precision<float, Policy>::type t2;
+ typedef typename policies::precision<double, Policy>::type t3;
+ typedef typename policies::precision<long double, Policy>::type t4;
+ public:
+ typedef typename mpl::if_<
+ mpl::and_<boost::is_convertible<float, Real>, mpl::bool_< t1::value <= t2::value>, mpl::bool_<0 != t1::value> >,
+ mpl::int_<construct_from_float>,
+ typename mpl::if_<
+ mpl::and_<boost::is_convertible<double, Real>, mpl::bool_< t1::value <= t3::value>, mpl::bool_<0 != t1::value> >,
+ mpl::int_<construct_from_double>,
+ typename mpl::if_<
+ mpl::and_<boost::is_convertible<long double, Real>, mpl::bool_< t1::value <= t4::value>, mpl::bool_<0 != t1::value> >,
+ mpl::int_<construct_from_long_double>,
+ typename mpl::if_<
+ mpl::and_<mpl::bool_< t1::value <= max_string_digits>, mpl::bool_<0 != t1::value> >,
+ mpl::int_<construct_from_string>,
+ mpl::int_<t1::value>
+ >::type
+ >::type
+ >::type
+ >::type type;
+ };
+
+#ifdef BOOST_HAS_THREADS
+#define BOOST_MATH_CONSTANT_THREAD_HELPER(name, prefix) \
+ boost::once_flag f = BOOST_ONCE_INIT;\
+ boost::call_once(f, &BOOST_JOIN(BOOST_JOIN(string_, get_), name)<T>);
+#else
+#define BOOST_MATH_CONSTANT_THREAD_HELPER(name, prefix)
+#endif
+
+ namespace detail{
+
+ template <class Real>
+ Real convert_from_string(const char* p, const mpl::false_&)
+ {
+ return boost::lexical_cast<Real>(p);
+ }
+ template <class Real>
+ const char* convert_from_string(const char* p, const mpl::true_&)
+ {
+ return p;
+ }
+
+ template <class T, T (*F)(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
+ struct constant_initializer
+ {
+ static void force_instantiate()
+ {
+ init.force_instantiate();
+ }
+ private:
+ struct initializer
+ {
+ initializer()
+ {
+ F(
+ #ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+ 0
+ #endif
+ );
+ }
+ void force_instantiate()const{}
+ };
+ static const initializer init;
+ };
+
+ template <class T, T (*F)(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
+ typename constant_initializer<T, F>::initializer const constant_initializer<T, F>::init;
+
+ template <class T, int N, T (*F)(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
+ struct constant_initializer2
+ {
+ static void force_instantiate()
+ {
+ init.force_instantiate();
+ }
+ private:
+ struct initializer
+ {
+ initializer()
+ {
+ F(
+ #ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+ mpl::int_<N>() , 0
+ #endif
+ );
+ }
+ void force_instantiate()const{}
+ };
+ static const initializer init;
+ };
+
+ template <class T, int N, T (*F)(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
+ typename constant_initializer2<T, N, F>::initializer const constant_initializer2<T, N, F>::init;
+
+ }
+
+ #define BOOST_DEFINE_MATH_CONSTANT(name, x, y)\
+ namespace detail{\
+ template <class T> struct BOOST_JOIN(constant_, name){\
+ private:\
+ /* The default implementations come next: */ \
+ static inline T get_from_string()\
{\
- static const T result = ::boost::lexical_cast<T>(BOOST_STRINGIZE(BOOST_JOIN(BOOST_JOIN(x, y), BOOST_JOIN(e, exp))));\
+ static const T result = convert_from_string<T>(y, boost::is_convertible<const char*, T>());\
return result;\
}\
- template <> inline float name<float>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(float))\
- { return BOOST_JOIN(BOOST_JOIN(x, BOOST_JOIN(e, exp)), F); }\
- template <> inline double name<double>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(double))\
- { return BOOST_JOIN(x, BOOST_JOIN(e, exp)); }\
- template <> inline long double name<long double>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(long double))\
- { return BOOST_JOIN(BOOST_JOIN(x, BOOST_JOIN(e, exp)), L); }
-
- BOOST_DEFINE_MATH_CONSTANT(pi, 3.141592653589793238462643383279502884197169399375105820974944, 59230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196, 0)
- BOOST_DEFINE_MATH_CONSTANT(two_pi, 6.2831853071795864769252867665590057683943388015061, 0, 0)
- BOOST_DEFINE_MATH_CONSTANT(root_pi, 1.7724538509055160272981674833411451827975, 0, 0)
- BOOST_DEFINE_MATH_CONSTANT(root_half_pi, 1.253314137315500251207882642405522626503, 0, 0)
- BOOST_DEFINE_MATH_CONSTANT(root_two_pi, 2.506628274631000502415765284811045253007, 0, 0)
- BOOST_DEFINE_MATH_CONSTANT(root_ln_four, 1.1774100225154746910115693264596996377473856893858205385225257565000, 2658854698492680841813836877081, 0)
- BOOST_DEFINE_MATH_CONSTANT(e, 2.7182818284590452353602874713526624977572470936999595749669676, 27724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011, 0)
- BOOST_DEFINE_MATH_CONSTANT(half, 0.5, 0, 0)
- BOOST_DEFINE_MATH_CONSTANT(euler, 0.577215664901532860606512090082402431042159335939923598805, 76723488486, 0)
- BOOST_DEFINE_MATH_CONSTANT(root_two, 1.414213562373095048801688724209698078569671875376948073, 17667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206, 0)
- BOOST_DEFINE_MATH_CONSTANT(half_root_two, 0.70710678118654752440084436210484903928483593756084, 0, 0)
- BOOST_DEFINE_MATH_CONSTANT(ln_two, 0.693147180559945309417232121458176568075500134360255254, 120680009493393621969694715605863326996418687, 0)
- BOOST_DEFINE_MATH_CONSTANT(ln_ln_two, -0.36651292058166432701243915823266946945426344783710526305367771367056, 16153193527385494558228566989083583025230453648347655663425171940646634, 0)
- BOOST_DEFINE_MATH_CONSTANT(third, 0.3333333333333333333333333333333333333333333333333333333333333333333333, 3333333333333333333333333333333333333333333333333333333333333333333333333, 0)
- BOOST_DEFINE_MATH_CONSTANT(twothirds, 0.66666666666666666666666666666666666666666666666666666666666666666666, 66666666666666666666666666666666666666666666666666666666666666666666667, 0) //deprecated, use two_thirds.
- BOOST_DEFINE_MATH_CONSTANT(two_thirds, 0.66666666666666666666666666666666666666666666666666666666666666666666, 66666666666666666666666666666666666666666666666666666666666666666666667, 0)
- BOOST_DEFINE_MATH_CONSTANT(pi_minus_three, 0.141592653589793238462643383279502884197169399375105820974944, 59230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196, 0)
- BOOST_DEFINE_MATH_CONSTANT(four_minus_pi, 0.85840734641020676153735661672049711580283060062489417902505540769218359, 0, 0)
- BOOST_DEFINE_MATH_CONSTANT(pow23_four_minus_pi, 0.79531676737159754434839533505680658072763917332771320544530223438582161, 0, 0)
- BOOST_DEFINE_MATH_CONSTANT(exp_minus_half, 0.6065306597126334236037995349911804534419181354871869556828921587350565194137, 484239986476115079894560, 0)
- } // namespace constants
+ /* This one is for very high precision that is none the less known at compile time: */ \
+ template <int N> static T compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>));\
+ /* public getters come next */\
+ public:\
+ static inline T get(const mpl::int_<construct_from_string>&)\
+ {\
+ constant_initializer<T, & BOOST_JOIN(constant_, name)<T>::get_from_string >::force_instantiate();\
+ return get_from_string();\
+ }\
+ static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_float>)\
+ { return BOOST_JOIN(x, F); }\
+ static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_double>&)\
+ { return x; }\
+ static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_long_double>&)\
+ { return BOOST_JOIN(x, L); }\
+ template <int N> static inline T get(const mpl::int_<N>& n)\
+ {\
+ constant_initializer2<T, N, & BOOST_JOIN(constant_, name)<T>::template compute<N> >::force_instantiate();\
+ return compute<N>(); \
+ }\
+ /* This one is for true arbitary precision, which may well vary at runtime: */ \
+ static inline T get(const mpl::int_<0>&)\
+ { return tools::digits<T>() > max_string_digits ? compute<0>() : get(mpl::int_<construct_from_string>()); }\
+ }; /* end of struct */\
+ } /* namespace detail */ \
+ \
+ \
+ /* The actual forwarding function: */ \
+ template <class T, class Policy> inline BOOST_CONSTEXPR T name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy))\
+ { return detail:: BOOST_JOIN(constant_, name)<T>::get(typename construction_traits<T, Policy>::type()); }\
+ template <class T> inline BOOST_CONSTEXPR T name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T))\
+ { return name<T, boost::math::policies::policy<> >(); }\
+ \
+ \
+ /* Now the namespace specific versions: */ \
+ } namespace float_constants{ static const float name = BOOST_JOIN(x, F); }\
+ namespace double_constants{ static const double name = x; } \
+ namespace long_double_constants{ static const long double name = BOOST_JOIN(x, L); }\
+ namespace constants{
+
+ BOOST_DEFINE_MATH_CONSTANT(half, 5.000000000000000000000000000000000000e-01, "5.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-01")
+ BOOST_DEFINE_MATH_CONSTANT(third, 3.333333333333333333333333333333333333e-01, "3.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333e-01")
+ BOOST_DEFINE_MATH_CONSTANT(twothirds, 6.666666666666666666666666666666666666e-01, "6.66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667e-01")
+ BOOST_DEFINE_MATH_CONSTANT(two_thirds, 6.666666666666666666666666666666666666e-01, "6.66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667e-01")
+ BOOST_DEFINE_MATH_CONSTANT(three_quarters, 7.500000000000000000000000000000000000e-01, "7.50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-01")
+ BOOST_DEFINE_MATH_CONSTANT(root_two, 1.414213562373095048801688724209698078e+00, "1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623e+00")
+ BOOST_DEFINE_MATH_CONSTANT(root_three, 1.732050807568877293527446341505872366e+00, "1.73205080756887729352744634150587236694280525381038062805580697945193301690880003708114618675724857567562614142e+00")
+ BOOST_DEFINE_MATH_CONSTANT(half_root_two, 7.071067811865475244008443621048490392e-01, "7.07106781186547524400844362104849039284835937688474036588339868995366239231053519425193767163820786367506923115e-01")
+ BOOST_DEFINE_MATH_CONSTANT(ln_two, 6.931471805599453094172321214581765680e-01, "6.93147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418687542001481021e-01")
+ BOOST_DEFINE_MATH_CONSTANT(ln_ln_two, -3.665129205816643270124391582326694694e-01, "-3.66512920581664327012439158232669469454263447837105263053677713670561615319352738549455822856698908358302523045e-01")
+ BOOST_DEFINE_MATH_CONSTANT(root_ln_four, 1.177410022515474691011569326459699637e+00, "1.17741002251547469101156932645969963774738568938582053852252575650002658854698492680841813836877081106747157858e+00")
+ BOOST_DEFINE_MATH_CONSTANT(one_div_root_two, 7.071067811865475244008443621048490392e-01, "7.07106781186547524400844362104849039284835937688474036588339868995366239231053519425193767163820786367506923115e-01")
+ BOOST_DEFINE_MATH_CONSTANT(pi, 3.141592653589793238462643383279502884e+00, "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+00")
+ BOOST_DEFINE_MATH_CONSTANT(half_pi, 1.570796326794896619231321691639751442e+00, "1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404326e+00")
+ BOOST_DEFINE_MATH_CONSTANT(third_pi, 1.047197551196597746154214461093167628e+00, "1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550e+00")
+ BOOST_DEFINE_MATH_CONSTANT(sixth_pi, 5.235987755982988730771072305465838140e-01, "5.23598775598298873077107230546583814032861566562517636829157432051302734381034833104672470890352844663691347752e-01")
+ BOOST_DEFINE_MATH_CONSTANT(two_pi, 6.283185307179586476925286766559005768e+00, "6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617303e+00")
+ BOOST_DEFINE_MATH_CONSTANT(two_thirds_pi, 2.094395102393195492308428922186335256e+00, "2.09439510239319549230842892218633525613144626625007054731662972820521093752413933241868988356141137865476539101e+00")
+ BOOST_DEFINE_MATH_CONSTANT(three_quarters_pi, 2.356194490192344928846982537459627163e+00, "2.35619449019234492884698253745962716314787704953132936573120844423086230471465674897102611900658780098661106488e+00")
+ BOOST_DEFINE_MATH_CONSTANT(four_thirds_pi, 4.188790204786390984616857844372670512e+00, "4.18879020478639098461685784437267051226289253250014109463325945641042187504827866483737976712282275730953078202e+00")
+ BOOST_DEFINE_MATH_CONSTANT(one_div_two_pi, 1.591549430918953357688837633725143620e-01, "1.59154943091895335768883763372514362034459645740456448747667344058896797634226535090113802766253085956072842727e-01")
+ BOOST_DEFINE_MATH_CONSTANT(one_div_root_two_pi, 3.989422804014326779399460599343818684e-01, "3.98942280401432677939946059934381868475858631164934657665925829670657925899301838501252333907306936430302558863e-01")
+ BOOST_DEFINE_MATH_CONSTANT(root_pi, 1.772453850905516027298167483341145182e+00, "1.77245385090551602729816748334114518279754945612238712821380778985291128459103218137495065673854466541622682362e+00")
+ BOOST_DEFINE_MATH_CONSTANT(root_half_pi, 1.253314137315500251207882642405522626e+00, "1.25331413731550025120788264240552262650349337030496915831496178817114682730392098747329791918902863305800498633e+00")
+ BOOST_DEFINE_MATH_CONSTANT(root_two_pi, 2.506628274631000502415765284811045253e+00, "2.50662827463100050241576528481104525300698674060993831662992357634229365460784197494659583837805726611600997267e+00")
+ BOOST_DEFINE_MATH_CONSTANT(one_div_root_pi, 5.641895835477562869480794515607725858e-01, "5.64189583547756286948079451560772585844050629328998856844085721710642468441493414486743660202107363443028347906e-01")
+ BOOST_DEFINE_MATH_CONSTANT(root_one_div_pi, 5.641895835477562869480794515607725858e-01, "5.64189583547756286948079451560772585844050629328998856844085721710642468441493414486743660202107363443028347906e-01")
+ BOOST_DEFINE_MATH_CONSTANT(pi_minus_three, 1.415926535897932384626433832795028841e-01, "1.41592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513e-01")
+ BOOST_DEFINE_MATH_CONSTANT(four_minus_pi, 8.584073464102067615373566167204971158e-01, "8.58407346410206761537356616720497115802830600624894179025055407692183593713791001371965174657882932017851913487e-01")
+ BOOST_DEFINE_MATH_CONSTANT(pow23_four_minus_pi, 7.953167673715975443483953350568065807e-01, "7.95316767371597544348395335056806580727639173327713205445302234388856268267518187590758006888600828436839800178e-01")
+ BOOST_DEFINE_MATH_CONSTANT(pi_pow_e, 2.245915771836104547342715220454373502e+01, "2.24591577183610454734271522045437350275893151339966922492030025540669260403991179123185197527271430315314500731e+01")
+ BOOST_DEFINE_MATH_CONSTANT(pi_sqr, 9.869604401089358618834490999876151135e+00, "9.86960440108935861883449099987615113531369940724079062641334937622004482241920524300177340371855223182402591377e+00")
+ BOOST_DEFINE_MATH_CONSTANT(pi_sqr_div_six, 1.644934066848226436472415166646025189e+00, "1.64493406684822643647241516664602518921894990120679843773555822937000747040320087383362890061975870530400431896e+00")
+ BOOST_DEFINE_MATH_CONSTANT(pi_cubed, 3.100627668029982017547631506710139520e+01, "3.10062766802998201754763150671013952022252885658851076941445381038063949174657060375667010326028861930301219616e+01")
+ BOOST_DEFINE_MATH_CONSTANT(cbrt_pi, 1.464591887561523263020142527263790391e+00, "1.46459188756152326302014252726379039173859685562793717435725593713839364979828626614568206782035382089750397002e+00")
+ BOOST_DEFINE_MATH_CONSTANT(one_div_cbrt_pi, 6.827840632552956814670208331581645981e-01, "6.82784063255295681467020833158164598108367515632448804042681583118899226433403918237673501922595519865685577274e-01")
+ BOOST_DEFINE_MATH_CONSTANT(e, 2.718281828459045235360287471352662497e+00, "2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193e+00")
+ BOOST_DEFINE_MATH_CONSTANT(exp_minus_half, 6.065306597126334236037995349911804534e-01, "6.06530659712633423603799534991180453441918135487186955682892158735056519413748423998647611507989456026423789794e-01")
+ BOOST_DEFINE_MATH_CONSTANT(e_pow_pi, 2.314069263277926900572908636794854738e+01, "2.31406926327792690057290863679485473802661062426002119934450464095243423506904527835169719970675492196759527048e+01")
+ BOOST_DEFINE_MATH_CONSTANT(root_e, 1.648721270700128146848650787814163571e+00, "1.64872127070012814684865078781416357165377610071014801157507931164066102119421560863277652005636664300286663776e+00")
+ BOOST_DEFINE_MATH_CONSTANT(log10_e, 4.342944819032518276511289189166050822e-01, "4.34294481903251827651128918916605082294397005803666566114453783165864649208870774729224949338431748318706106745e-01")
+ BOOST_DEFINE_MATH_CONSTANT(one_div_log10_e, 2.302585092994045684017991454684364207e+00, "2.30258509299404568401799145468436420760110148862877297603332790096757260967735248023599720508959829834196778404e+00")
+ BOOST_DEFINE_MATH_CONSTANT(ln_ten, 2.302585092994045684017991454684364207e+00, "2.30258509299404568401799145468436420760110148862877297603332790096757260967735248023599720508959829834196778404e+00")
+ BOOST_DEFINE_MATH_CONSTANT(degree, 1.745329251994329576923690768488612713e-02, "1.74532925199432957692369076848861271344287188854172545609719144017100911460344944368224156963450948221230449251e-02")
+ BOOST_DEFINE_MATH_CONSTANT(radian, 5.729577951308232087679815481410517033e+01, "5.72957795130823208767981548141051703324054724665643215491602438612028471483215526324409689958511109441862233816e+01")
+ BOOST_DEFINE_MATH_CONSTANT(sin_one, 8.414709848078965066525023216302989996e-01, "8.41470984807896506652502321630298999622563060798371065672751709991910404391239668948639743543052695854349037908e-01")
+ BOOST_DEFINE_MATH_CONSTANT(cos_one, 5.403023058681397174009366074429766037e-01, "5.40302305868139717400936607442976603732310420617922227670097255381100394774471764517951856087183089343571731160e-01")
+ BOOST_DEFINE_MATH_CONSTANT(sinh_one, 1.175201193643801456882381850595600815e+00, "1.17520119364380145688238185059560081515571798133409587022956541301330756730432389560711745208962339184041953333e+00")
+ BOOST_DEFINE_MATH_CONSTANT(cosh_one, 1.543080634815243778477905620757061682e+00, "1.54308063481524377847790562075706168260152911236586370473740221471076906304922369896426472643554303558704685860e+00")
+ BOOST_DEFINE_MATH_CONSTANT(phi, 1.618033988749894848204586834365638117e+00, "1.61803398874989484820458683436563811772030917980576286213544862270526046281890244970720720418939113748475408808e+00")
+ BOOST_DEFINE_MATH_CONSTANT(ln_phi, 4.812118250596034474977589134243684231e-01, "4.81211825059603447497758913424368423135184334385660519661018168840163867608221774412009429122723474997231839958e-01")
+ BOOST_DEFINE_MATH_CONSTANT(one_div_ln_phi, 2.078086921235027537601322606117795767e+00, "2.07808692123502753760132260611779576774219226778328348027813992191974386928553540901445615414453604821933918634e+00")
+ BOOST_DEFINE_MATH_CONSTANT(euler, 5.772156649015328606065120900824024310e-01, "5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447250e-01")
+ BOOST_DEFINE_MATH_CONSTANT(one_div_euler, 1.732454714600633473583025315860829681e+00, "1.73245471460063347358302531586082968115577655226680502204843613287065531408655243008832840219409928068072365714e+00")
+ BOOST_DEFINE_MATH_CONSTANT(euler_sqr, 3.331779238077186743183761363552442266e-01, "3.33177923807718674318376136355244226659417140249629743150833338002265793695756669661263268631715977303039565603e-01")
+ BOOST_DEFINE_MATH_CONSTANT(zeta_two, 1.644934066848226436472415166646025189e+00, "1.64493406684822643647241516664602518921894990120679843773555822937000747040320087383362890061975870530400431896e+00")
+ BOOST_DEFINE_MATH_CONSTANT(zeta_three, 1.202056903159594285399738161511449990e+00, "1.20205690315959428539973816151144999076498629234049888179227155534183820578631309018645587360933525814619915780e+00")
+ BOOST_DEFINE_MATH_CONSTANT(catalan, 9.159655941772190150546035149323841107e-01, "9.15965594177219015054603514932384110774149374281672134266498119621763019776254769479356512926115106248574422619e-01")
+ BOOST_DEFINE_MATH_CONSTANT(glaisher, 1.282427129100622636875342568869791727e+00, "1.28242712910062263687534256886979172776768892732500119206374002174040630885882646112973649195820237439420646120e+00")
+ BOOST_DEFINE_MATH_CONSTANT(khinchin, 2.685452001065306445309714835481795693e+00, "2.68545200106530644530971483548179569382038229399446295305115234555721885953715200280114117493184769799515346591e+00")
+ BOOST_DEFINE_MATH_CONSTANT(extreme_value_skewness, 1.139547099404648657492793019389846112e+00, "1.13954709940464865749279301938984611208759979583655182472165571008524800770607068570718754688693851501894272049e+00")
+ BOOST_DEFINE_MATH_CONSTANT(rayleigh_skewness, 6.311106578189371381918993515442277798e-01, "6.31110657818937138191899351544227779844042203134719497658094585692926819617473725459905027032537306794400047264e-01")
+ BOOST_DEFINE_MATH_CONSTANT(rayleigh_kurtosis, 3.245089300687638062848660410619754415e+00, "3.24508930068763806284866041061975441541706673178920936177133764493367904540874159051490619368679348977426462633e+00")
+ BOOST_DEFINE_MATH_CONSTANT(rayleigh_kurtosis_excess, 2.450893006876380628486604106197544154e-01, "2.45089300687638062848660410619754415417066731789209361771337644933679045408741590514906193686793489774264626328e-01")
+
+ BOOST_DEFINE_MATH_CONSTANT(two_div_pi, 6.366197723675813430755350534900574481e-01, "6.36619772367581343075535053490057448137838582961825794990669376235587190536906140360455211065012343824291370907e-01")
+ BOOST_DEFINE_MATH_CONSTANT(root_two_div_pi, 7.978845608028653558798921198687637369e-01, "7.97884560802865355879892119868763736951717262329869315331851659341315851798603677002504667814613872860605117725e-01")
+
+
+} // namespace constants
} // namespace math
} // namespace boost
+//
+// We deliberately include this *after* all the declarations above,
+// that way the calculation routines can call on other constants above:
+//
+#include <boost/math/constants/calculate_constants.hpp>
+
#endif // BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED
+
Modified: branches/release/boost/math/distributions/detail/inv_discrete_quantile.hpp
==============================================================================
--- branches/release/boost/math/distributions/detail/inv_discrete_quantile.hpp (original)
+++ branches/release/boost/math/distributions/detail/inv_discrete_quantile.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -124,6 +124,8 @@
--count;
if(fb == 0)
return b;
+ if(a == b)
+ return b; // can't go any higher!
}
else
{
@@ -135,6 +137,8 @@
--count;
if(fa == 0)
return a;
+ if(a == b)
+ return a; // We can't go any lower than this!
}
}
}
@@ -208,7 +212,7 @@
// Zero is to the right of x2, so walk upwards
// until we find it:
//
- while((boost::math::sign)(fb) == (boost::math::sign)(fa))
+ while(((boost::math::sign)(fb) == (boost::math::sign)(fa)) && (a != b))
{
if(count == 0)
policies::raise_evaluation_error(function, "Unable to bracket root, last nearest value was %1%", b, policy_type());
@@ -228,7 +232,7 @@
// Zero is to the left of a, so walk downwards
// until we find it:
//
- while((boost::math::sign)(fb) == (boost::math::sign)(fa))
+ while(((boost::math::sign)(fb) == (boost::math::sign)(fa)) && (a != b))
{
if(fabs(a) < tools::min_value<value_type>())
{
@@ -255,6 +259,8 @@
return a;
if(fb == 0)
return b;
+ if(a == b)
+ return b; // Ran out of bounds trying to bracket - there is no answer!
//
// Adjust bounds so that if we're looking for an integer
// result, then both ends round the same way:
Modified: branches/release/boost/math/distributions/triangular.hpp
==============================================================================
--- branches/release/boost/math/distributions/triangular.hpp (original)
+++ branches/release/boost/math/distributions/triangular.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -470,7 +470,7 @@
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result = 0; // of checks.
- if(false == detail::check_triangular(function,lower, mode, upper, &result, Policy()))
+ if(false == boost::math::detail::check_triangular(function,lower, mode, upper, &result, Policy()))
{
return result;
}
Modified: branches/release/boost/math/policies/error_handling.hpp
==============================================================================
--- branches/release/boost/math/policies/error_handling.hpp (original)
+++ branches/release/boost/math/policies/error_handling.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -12,6 +12,7 @@
#include <iomanip>
#include <string>
#include <cerrno>
+#include <complex>
#include <boost/config/no_tr1/cmath.hpp>
#include <stdexcept>
#include <boost/math/tools/config.hpp>
@@ -576,6 +577,15 @@
return false;
}
template <class R, class T, class Policy>
+inline bool check_overflow(std::complex<T> val, R* result, const char* function, const Policy& pol)
+{
+ typedef typename R::value_type r_type;
+ r_type re, im;
+ bool r = check_overflow<r_type>(val.real(), &re, function, pol) || check_overflow<r_type>(val.imag(), &im, function, pol);
+ *result = R(re, im);
+ return r;
+}
+template <class R, class T, class Policy>
inline bool check_underflow(T val, R* result, const char* function, const Policy& pol)
{
if((val != 0) && (static_cast<R>(val) == 0))
@@ -586,6 +596,15 @@
return false;
}
template <class R, class T, class Policy>
+inline bool check_underflow(std::complex<T> val, R* result, const char* function, const Policy& pol)
+{
+ typedef typename R::value_type r_type;
+ r_type re, im;
+ bool r = check_underflow<r_type>(val.real(), &re, function, pol) || check_underflow<r_type>(val.imag(), &im, function, pol);
+ *result = R(re, im);
+ return r;
+}
+template <class R, class T, class Policy>
inline bool check_denorm(T val, R* result, const char* function, const Policy& pol)
{
BOOST_MATH_STD_USING
@@ -596,14 +615,29 @@
}
return false;
}
+template <class R, class T, class Policy>
+inline bool check_denorm(std::complex<T> val, R* result, const char* function, const Policy& pol)
+{
+ typedef typename R::value_type r_type;
+ r_type re, im;
+ bool r = check_denorm<r_type>(val.real(), &re, function, pol) || check_denorm<r_type>(val.imag(), &im, function, pol);
+ *result = R(re, im);
+ return r;
+}
// Default instantiations with ignore_error policy.
template <class R, class T>
inline bool check_overflow(T /* val */, R* /* result */, const char* /* function */, const overflow_error<ignore_error>&){ return false; }
template <class R, class T>
+inline bool check_overflow(std::complex<T> /* val */, R* /* result */, const char* /* function */, const overflow_error<ignore_error>&){ return false; }
+template <class R, class T>
inline bool check_underflow(T /* val */, R* /* result */, const char* /* function */, const underflow_error<ignore_error>&){ return false; }
template <class R, class T>
+inline bool check_underflow(std::complex<T> /* val */, R* /* result */, const char* /* function */, const underflow_error<ignore_error>&){ return false; }
+template <class R, class T>
inline bool check_denorm(T /* val */, R* /* result*/, const char* /* function */, const denorm_error<ignore_error>&){ return false; }
+template <class R, class T>
+inline bool check_denorm(std::complex<T> /* val */, R* /* result*/, const char* /* function */, const denorm_error<ignore_error>&){ return false; }
} // namespace detail
Modified: branches/release/boost/math/special_functions.hpp
==============================================================================
--- branches/release/boost/math/special_functions.hpp (original)
+++ branches/release/boost/math/special_functions.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -55,5 +55,7 @@
#include <boost/math/special_functions/trunc.hpp>
#include <boost/math/special_functions/pow.hpp>
#include <boost/math/special_functions/next.hpp>
+#include <boost/math/special_functions/owens_t.hpp>
+#include <boost/math/special_functions/hankel.hpp>
#endif // BOOST_MATH_SPECIAL_FUNCTIONS_HPP
Modified: branches/release/boost/math/special_functions/detail/bessel_i0.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/bessel_i0.hpp (original)
+++ branches/release/boost/math/special_functions/detail/bessel_i0.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -21,8 +21,38 @@
namespace boost { namespace math { namespace detail{
template <typename T>
+T bessel_i0(T x);
+
+template <class T>
+struct bessel_i0_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init();
+ }
+ static void do_init()
+ {
+ bessel_i0(T(1));
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T>
+const typename bessel_i0_initializer<T>::init bessel_i0_initializer<T>::initializer;
+
+template <typename T>
T bessel_i0(T x)
{
+ bessel_i0_initializer<T>::force_instantiate();
+
static const T P1[] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -2.2335582639474375249e+15)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -5.5050369673018427753e+14)),
Modified: branches/release/boost/math/special_functions/detail/bessel_i1.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/bessel_i1.hpp (original)
+++ branches/release/boost/math/special_functions/detail/bessel_i1.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -21,8 +21,39 @@
namespace boost { namespace math { namespace detail{
template <typename T>
+T bessel_i1(T x);
+
+template <class T>
+struct bessel_i1_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init();
+ }
+ static void do_init()
+ {
+ bessel_i1(T(1));
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T>
+const typename bessel_i1_initializer<T>::init bessel_i1_initializer<T>::initializer;
+
+template <typename T>
T bessel_i1(T x)
{
+
+ bessel_i1_initializer<T>::force_instantiate();
+
static const T P1[] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.4577180278143463643e+15)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.7732037840791591320e+14)),
Modified: branches/release/boost/math/special_functions/detail/bessel_j0.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/bessel_j0.hpp (original)
+++ branches/release/boost/math/special_functions/detail/bessel_j0.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -22,8 +22,38 @@
namespace boost { namespace math { namespace detail{
template <typename T>
+T bessel_j0(T x);
+
+template <class T>
+struct bessel_j0_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init();
+ }
+ static void do_init()
+ {
+ bessel_j0(T(1));
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T>
+const typename bessel_j0_initializer<T>::init bessel_j0_initializer<T>::initializer;
+
+template <typename T>
T bessel_j0(T x)
{
+ bessel_j0_initializer<T>::force_instantiate();
+
static const T P1[] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -4.1298668500990866786e+11)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.7282507878605942706e+10)),
Modified: branches/release/boost/math/special_functions/detail/bessel_j1.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/bessel_j1.hpp (original)
+++ branches/release/boost/math/special_functions/detail/bessel_j1.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -22,8 +22,38 @@
namespace boost { namespace math{ namespace detail{
template <typename T>
+T bessel_j1(T x);
+
+template <class T>
+struct bessel_j1_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init();
+ }
+ static void do_init()
+ {
+ bessel_j1(T(1));
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T>
+const typename bessel_j1_initializer<T>::init bessel_j1_initializer<T>::initializer;
+
+template <typename T>
T bessel_j1(T x)
{
+ bessel_j1_initializer<T>::force_instantiate();
+
static const T P1[] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.4258509801366645672e+11)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 6.6781041261492395835e+09)),
Modified: branches/release/boost/math/special_functions/detail/bessel_jy.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/bessel_jy.hpp (original)
+++ branches/release/boost/math/special_functions/detail/bessel_jy.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -215,8 +215,6 @@
Cr = br + a / temp;
Dr = br;
Di = bi;
- //std::cout << "C = " << Cr << " " << Ci << std::endl;
- //std::cout << "D = " << Dr << " " << Di << std::endl;
if (fabs(Cr) + fabs(Ci) < tiny) { Cr = tiny; }
if (fabs(Dr) + fabs(Di) < tiny) { Dr = tiny; }
temp = Dr * Dr + Di * Di;
@@ -227,7 +225,6 @@
temp = fr;
fr = temp * delta_r - fi * delta_i;
fi = temp * delta_i + fi * delta_r;
- //std::cout << fr << " " << fi << std::endl;
for (k = 2; k < policies::get_max_series_iterations<Policy>(); k++)
{
a = k - 0.5f;
@@ -239,8 +236,6 @@
Ci = bi - a * Ci / temp;
Dr = br + a * Dr;
Di = bi + a * Di;
- //std::cout << "C = " << Cr << " " << Ci << std::endl;
- //std::cout << "D = " << Dr << " " << Di << std::endl;
if (fabs(Cr) + fabs(Ci) < tiny) { Cr = tiny; }
if (fabs(Dr) + fabs(Di) < tiny) { Dr = tiny; }
temp = Dr * Dr + Di * Di;
@@ -253,7 +248,6 @@
fi = temp * delta_i + fi * delta_r;
if (fabs(delta_r - 1) + fabs(delta_i) < tolerance)
break;
- //std::cout << fr << " " << fi << std::endl;
}
policies::check_series_iterations<T>("boost::math::bessel_jy<%1%>(%1%,%1%) in CF2_jy", k, pol);
*p = fr;
@@ -491,6 +485,16 @@
CF2_jy(u, x, &p, &q, pol); // continued fraction CF2_jy
T t = u / x - fu; // t = J'/J
gamma = (p - t) / q;
+ //
+ // We can't allow gamma to cancel out to zero competely as it messes up
+ // the subsequent logic. So pretend that one bit didn't cancel out
+ // and set to a suitably small value. The only test case we've been able to
+ // find for this, is when v = 8.5 and x = 4*PI.
+ //
+ if(gamma == 0)
+ {
+ gamma = u * tools::epsilon<T>() / x;
+ }
Ju = sign(current) * sqrt(W / (q + gamma * (p - t)));
Jv = Ju * ratio; // normalization
Modified: branches/release/boost/math/special_functions/detail/bessel_k0.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/bessel_k0.hpp (original)
+++ branches/release/boost/math/special_functions/detail/bessel_k0.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -22,10 +22,40 @@
namespace boost { namespace math { namespace detail{
template <typename T, typename Policy>
+T bessel_k0(T x, const Policy&);
+
+template <class T, class Policy>
+struct bessel_k0_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init();
+ }
+ static void do_init()
+ {
+ bessel_k0(T(1), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy>
+const typename bessel_k0_initializer<T, Policy>::init bessel_k0_initializer<T, Policy>::initializer;
+
+template <typename T, typename Policy>
T bessel_k0(T x, const Policy& pol)
{
BOOST_MATH_INSTRUMENT_CODE(x);
+ bessel_k0_initializer<T, Policy>::force_instantiate();
+
static const T P1[] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.4708152720399552679e+03)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.9169059852270512312e+03)),
Modified: branches/release/boost/math/special_functions/detail/bessel_k1.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/bessel_k1.hpp (original)
+++ branches/release/boost/math/special_functions/detail/bessel_k1.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -22,8 +22,38 @@
namespace boost { namespace math { namespace detail{
template <typename T, typename Policy>
+T bessel_k1(T x, const Policy&);
+
+template <class T, class Policy>
+struct bessel_k1_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init();
+ }
+ static void do_init()
+ {
+ bessel_k1(T(1), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy>
+const typename bessel_k1_initializer<T, Policy>::init bessel_k1_initializer<T, Policy>::initializer;
+
+template <typename T, typename Policy>
T bessel_k1(T x, const Policy& pol)
{
+ bessel_k1_initializer<T, Policy>::force_instantiate();
+
static const T P1[] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -2.2149374878243304548e+06)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 7.1938920065420586101e+05)),
Modified: branches/release/boost/math/special_functions/detail/bessel_y0.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/bessel_y0.hpp (original)
+++ branches/release/boost/math/special_functions/detail/bessel_y0.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -24,8 +24,38 @@
namespace boost { namespace math { namespace detail{
template <typename T, typename Policy>
+T bessel_y0(T x, const Policy&);
+
+template <class T, class Policy>
+struct bessel_y0_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init();
+ }
+ static void do_init()
+ {
+ bessel_y0(T(1), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy>
+const typename bessel_y0_initializer<T, Policy>::init bessel_y0_initializer<T, Policy>::initializer;
+
+template <typename T, typename Policy>
T bessel_y0(T x, const Policy& pol)
{
+ bessel_y0_initializer<T, Policy>::force_instantiate();
+
static const T P1[] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0723538782003176831e+11)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -8.3716255451260504098e+09)),
Modified: branches/release/boost/math/special_functions/detail/bessel_y1.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/bessel_y1.hpp (original)
+++ branches/release/boost/math/special_functions/detail/bessel_y1.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -24,8 +24,38 @@
namespace boost { namespace math { namespace detail{
template <typename T, typename Policy>
+T bessel_y1(T x, const Policy&);
+
+template <class T, class Policy>
+struct bessel_y1_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init();
+ }
+ static void do_init()
+ {
+ bessel_y1(T(1), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy>
+const typename bessel_y1_initializer<T, Policy>::init bessel_y1_initializer<T, Policy>::initializer;
+
+template <typename T, typename Policy>
T bessel_y1(T x, const Policy& pol)
{
+ bessel_y1_initializer<T, Policy>::force_instantiate();
+
static const T P1[] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.0535726612579544093e+13)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.4708611716525426053e+12)),
Modified: branches/release/boost/math/special_functions/detail/erf_inv.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/erf_inv.hpp (original)
+++ branches/release/boost/math/special_functions/detail/erf_inv.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -322,12 +322,47 @@
return result;
}
+template <class T, class Policy>
+struct erf_inv_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init();
+ }
+ static void do_init()
+ {
+ boost::math::erf_inv(static_cast<T>(0.25), Policy());
+ boost::math::erf_inv(static_cast<T>(0.55), Policy());
+ boost::math::erf_inv(static_cast<T>(0.95), Policy());
+ boost::math::erfc_inv(static_cast<T>(1e-15), Policy());
+ if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-130)) != 0)
+ boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-130)), Policy());
+ if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)) != 0)
+ boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)), Policy());
+ if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)) != 0)
+ boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy>
+const typename erf_inv_initializer<T, Policy>::init erf_inv_initializer<T, Policy>::initializer;
+
} // namespace detail
template <class T, class Policy>
typename tools::promote_args<T>::type erfc_inv(T z, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
+
//
// Begin by testing for domain errors, and other special cases:
//
@@ -378,6 +413,8 @@
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
+ detail::erf_inv_initializer<eval_type, forwarding_policy>::force_instantiate();
+
//
// And get the result, negating where required:
//
@@ -389,6 +426,7 @@
typename tools::promote_args<T>::type erf_inv(T z, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
+
//
// Begin by testing for domain errors, and other special cases:
//
@@ -445,6 +483,8 @@
// precision internally if it's appropriate:
//
typedef typename policies::evaluation<result_type, Policy>::type eval_type;
+
+ detail::erf_inv_initializer<eval_type, forwarding_policy>::force_instantiate();
//
// And get the result, negating where required:
//
Modified: branches/release/boost/math/special_functions/detail/iconv.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/iconv.hpp (original)
+++ branches/release/boost/math/special_functions/detail/iconv.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -25,7 +25,7 @@
inline int iconv_imp(T v, Policy const& pol, mpl::false_ const&)
{
BOOST_MATH_STD_USING
- return iround(v);
+ return iround(v, pol);
}
template <class T, class Policy>
Modified: branches/release/boost/math/special_functions/detail/igamma_large.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/igamma_large.hpp (original)
+++ branches/release/boost/math/special_functions/detail/igamma_large.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -759,7 +759,6 @@
return result;
}
-
} // namespace detail
} // namespace math
} // namespace math
Modified: branches/release/boost/math/special_functions/detail/lanczos_sse2.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/lanczos_sse2.hpp (original)
+++ branches/release/boost/math/special_functions/detail/lanczos_sse2.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -13,7 +13,7 @@
#include <emmintrin.h>
#if defined(__GNUC__) || defined(__PGI)
-#define ALIGN16 __attribute__((aligned(16)))
+#define ALIGN16 __attribute__((__aligned__(16)))
#else
#define ALIGN16 __declspec(align(16))
#endif
@@ -194,8 +194,11 @@
} // namespace math
} // namespace boost
+#undef ALIGN16
+
#endif // BOOST_MATH_SPECIAL_FUNCTIONS_LANCZOS
+
Modified: branches/release/boost/math/special_functions/detail/lgamma_small.hpp
==============================================================================
--- branches/release/boost/math/special_functions/detail/lgamma_small.hpp (original)
+++ branches/release/boost/math/special_functions/detail/lgamma_small.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -15,6 +15,14 @@
namespace boost{ namespace math{ namespace detail{
//
+// These need forward declaring to keep GCC happy:
+//
+template <class T, class Policy, class Lanczos>
+T gamma_imp(T z, const Policy& pol, const Lanczos& l);
+template <class T, class Policy>
+T gamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos& l);
+
+//
// lgamma for small arguments:
//
template <class T, class Policy, class Lanczos>
Modified: branches/release/boost/math/special_functions/digamma.hpp
==============================================================================
--- branches/release/boost/math/special_functions/digamma.hpp (original)
+++ branches/release/boost/math/special_functions/digamma.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -407,6 +407,31 @@
return result;
}
+//
+// Initializer: ensure all our constants are initialized prior to the first call of main:
+//
+template <class T, class Policy>
+struct digamma_initializer
+{
+ struct init
+ {
+ init()
+ {
+ boost::math::digamma(T(1.5), Policy());
+ boost::math::digamma(T(500), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy>
+const typename digamma_initializer<T, Policy>::init digamma_initializer<T, Policy>::initializer;
+
} // namespace detail
template <class T, class Policy>
@@ -433,6 +458,9 @@
>::type
>::type tag_type;
+ // Force initialization of constants:
+ detail::digamma_initializer<result_type, Policy>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, Policy>(detail::digamma_imp(
static_cast<value_type>(x),
static_cast<const tag_type*>(0), pol), "boost::math::digamma<%1%>(%1%)");
Modified: branches/release/boost/math/special_functions/erf.hpp
==============================================================================
--- branches/release/boost/math/special_functions/erf.hpp (original)
+++ branches/release/boost/math/special_functions/erf.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -978,6 +978,59 @@
return result;
} // template <class T, class Lanczos>T erf_imp(T z, bool invert, const Lanczos& l, const mpl::int_<113>& t)
+template <class T, class Policy, class tag>
+struct erf_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init(tag());
+ }
+ static void do_init(const mpl::int_<0>&){}
+ static void do_init(const mpl::int_<53>&)
+ {
+ boost::math::erf(static_cast<T>(1e-12), Policy());
+ boost::math::erf(static_cast<T>(0.25), Policy());
+ boost::math::erf(static_cast<T>(1.25), Policy());
+ boost::math::erf(static_cast<T>(2.25), Policy());
+ boost::math::erf(static_cast<T>(4.25), Policy());
+ boost::math::erf(static_cast<T>(5.25), Policy());
+ }
+ static void do_init(const mpl::int_<64>&)
+ {
+ boost::math::erf(static_cast<T>(1e-12), Policy());
+ boost::math::erf(static_cast<T>(0.25), Policy());
+ boost::math::erf(static_cast<T>(1.25), Policy());
+ boost::math::erf(static_cast<T>(2.25), Policy());
+ boost::math::erf(static_cast<T>(4.25), Policy());
+ boost::math::erf(static_cast<T>(5.25), Policy());
+ }
+ static void do_init(const mpl::int_<113>&)
+ {
+ boost::math::erf(static_cast<T>(1e-22), Policy());
+ boost::math::erf(static_cast<T>(0.25), Policy());
+ boost::math::erf(static_cast<T>(1.25), Policy());
+ boost::math::erf(static_cast<T>(2.125), Policy());
+ boost::math::erf(static_cast<T>(2.75), Policy());
+ boost::math::erf(static_cast<T>(3.25), Policy());
+ boost::math::erf(static_cast<T>(5.25), Policy());
+ boost::math::erf(static_cast<T>(7.25), Policy());
+ boost::math::erf(static_cast<T>(11.25), Policy());
+ boost::math::erf(static_cast<T>(12.5), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy, class tag>
+const typename erf_initializer<T, Policy, tag>::init erf_initializer<T, Policy, tag>::initializer;
+
} // namespace detail
template <class T, class Policy>
@@ -1017,6 +1070,8 @@
BOOST_MATH_INSTRUMENT_CODE("tag_type = " << typeid(tag_type).name());
+ detail::erf_initializer<value_type, forwarding_policy, tag_type>::force_instantiate(); // Force constants to be initialized before main
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(detail::erf_imp(
static_cast<value_type>(z),
false,
@@ -1061,6 +1116,8 @@
BOOST_MATH_INSTRUMENT_CODE("tag_type = " << typeid(tag_type).name());
+ detail::erf_initializer<value_type, forwarding_policy, tag_type>::force_instantiate(); // Force constants to be initialized before main
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(detail::erf_imp(
static_cast<value_type>(z),
true,
Modified: branches/release/boost/math/special_functions/expint.hpp
==============================================================================
--- branches/release/boost/math/special_functions/expint.hpp (original)
+++ branches/release/boost/math/special_functions/expint.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1473,6 +1473,94 @@
return result;
}
+template <class T, class Policy, class tag>
+struct expint_i_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init(tag());
+ }
+ static void do_init(const mpl::int_<0>&){}
+ static void do_init(const mpl::int_<53>&)
+ {
+ boost::math::expint(T(5));
+ boost::math::expint(T(7));
+ boost::math::expint(T(18));
+ boost::math::expint(T(38));
+ boost::math::expint(T(45));
+ }
+ static void do_init(const mpl::int_<64>&)
+ {
+ boost::math::expint(T(5));
+ boost::math::expint(T(7));
+ boost::math::expint(T(18));
+ boost::math::expint(T(38));
+ boost::math::expint(T(45));
+ }
+ static void do_init(const mpl::int_<113>&)
+ {
+ boost::math::expint(T(5));
+ boost::math::expint(T(7));
+ boost::math::expint(T(17));
+ boost::math::expint(T(25));
+ boost::math::expint(T(40));
+ boost::math::expint(T(50));
+ boost::math::expint(T(80));
+ boost::math::expint(T(200));
+ boost::math::expint(T(220));
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy, class tag>
+const typename expint_i_initializer<T, Policy, tag>::init expint_i_initializer<T, Policy, tag>::initializer;
+
+template <class T, class Policy, class tag>
+struct expint_1_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init(tag());
+ }
+ static void do_init(const mpl::int_<0>&){}
+ static void do_init(const mpl::int_<53>&)
+ {
+ boost::math::expint(1, T(0.5));
+ boost::math::expint(1, T(2));
+ }
+ static void do_init(const mpl::int_<64>&)
+ {
+ boost::math::expint(1, T(0.5));
+ boost::math::expint(1, T(2));
+ }
+ static void do_init(const mpl::int_<113>&)
+ {
+ boost::math::expint(1, T(0.5));
+ boost::math::expint(1, T(2));
+ boost::math::expint(1, T(6));
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy, class tag>
+const typename expint_1_initializer<T, Policy, tag>::init expint_1_initializer<T, Policy, tag>::initializer;
+
template <class T, class Policy>
inline typename tools::promote_args<T>::type
expint_forwarder(T z, const Policy& /*pol*/, mpl::true_ const&)
@@ -1504,6 +1592,8 @@
>::type
>::type tag_type;
+ expint_i_initializer<value_type, forwarding_policy, tag_type>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(detail::expint_i_imp(
static_cast<value_type>(z),
forwarding_policy(),
@@ -1550,6 +1640,8 @@
>::type
>::type tag_type;
+ detail::expint_1_initializer<value_type, forwarding_policy, tag_type>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(detail::expint_imp(
n,
static_cast<value_type>(z),
Modified: branches/release/boost/math/special_functions/expm1.hpp
==============================================================================
--- branches/release/boost/math/special_functions/expm1.hpp (original)
+++ branches/release/boost/math/special_functions/expm1.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -65,34 +65,37 @@
expm1_series& operator=(const expm1_series&);
};
-template <class T, bool b = boost::is_pod<T>::value>
-struct expm1_init_on_startup
+template <class T, class Policy, class tag>
+struct expm1_initializer
{
struct init
{
init()
{
- boost::math::expm1(T(0.5f));
+ do_init(tag());
}
- void do_nothing()const{}
+ template <int N>
+ static void do_init(const mpl::int_<N>&){}
+ static void do_init(const mpl::int_<64>&)
+ {
+ expm1(T(0.5));
+ }
+ static void do_init(const mpl::int_<113>&)
+ {
+ expm1(T(0.5));
+ }
+ void force_instantiate()const{}
};
-
- static void do_nothing()
+ static const init initializer;
+ static void force_instantiate()
{
- initializer.do_nothing();
+ initializer.force_instantiate();
}
-
- static const init initializer;
};
-template <class T, bool b>
-const typename expm1_init_on_startup<T, b>::init expm1_init_on_startup<T, b>::initializer;
+template <class T, class Policy, class tag>
+const typename expm1_initializer<T, Policy, tag>::init expm1_initializer<T, Policy, tag>::initializer;
-template <class T>
-struct expm1_init_on_startup<T, true>
-{
- static void do_nothing(){}
-};
//
// Algorithm expm1 is part of C99, but is not yet provided by many compilers.
//
@@ -133,8 +136,6 @@
{
BOOST_MATH_STD_USING
- expm1_init_on_startup<T>::do_nothing();
-
T a = fabs(x);
if(a > T(0.5L))
{
@@ -162,8 +163,6 @@
{
BOOST_MATH_STD_USING
- expm1_init_on_startup<T>::do_nothing();
-
T a = fabs(x);
if(a > T(0.5L))
{
@@ -207,8 +206,6 @@
{
BOOST_MATH_STD_USING
- expm1_init_on_startup<T>::do_nothing();
-
T a = fabs(x);
if(a > T(0.5L))
{
@@ -287,6 +284,8 @@
>::type
>::type tag_type;
+ detail::expm1_initializer<value_type, forwarding_policy, tag_type>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(detail::expm1_imp(
static_cast<value_type>(x),
tag_type(), forwarding_policy()), "boost::math::expm1<%1%>(%1%)");
Modified: branches/release/boost/math/special_functions/gamma.hpp
==============================================================================
--- branches/release/boost/math/special_functions/gamma.hpp (original)
+++ branches/release/boost/math/special_functions/gamma.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1258,6 +1258,101 @@
return policies::checked_narrowing_cast<result_type, forwarding_policy>(detail::gamma_imp(static_cast<value_type>(z), forwarding_policy(), evaluation_type()), "boost::math::tgamma<%1%>(%1%)");
}
+template <class T, class Policy>
+struct igamma_initializer
+{
+ struct init
+ {
+ init()
+ {
+ typedef typename policies::precision<T, Policy>::type precision_type;
+
+ typedef typename mpl::if_<
+ mpl::or_<mpl::equal_to<precision_type, mpl::int_<0> >,
+ mpl::greater<precision_type, mpl::int_<113> > >,
+ mpl::int_<0>,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<53> >,
+ mpl::int_<53>,
+ typename mpl::if_<
+ mpl::less_equal<precision_type, mpl::int_<64> >,
+ mpl::int_<64>,
+ mpl::int_<113>
+ >::type
+ >::type
+ >::type tag_type;
+
+ do_init(tag_type());
+ }
+ template <int N>
+ static void do_init(const mpl::int_<N>&)
+ {
+ boost::math::gamma_p(static_cast<T>(400), static_cast<T>(400), Policy());
+ }
+ static void do_init(const mpl::int_<53>&){}
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy>
+const typename igamma_initializer<T, Policy>::init igamma_initializer<T, Policy>::initializer;
+
+template <class T, class Policy>
+struct lgamma_initializer
+{
+ struct init
+ {
+ init()
+ {
+ typedef typename policies::precision<T, Policy>::type precision_type;
+ typedef typename mpl::if_<
+ mpl::and_<
+ mpl::less_equal<precision_type, mpl::int_<64> >,
+ mpl::greater<precision_type, mpl::int_<0> >
+ >,
+ mpl::int_<64>,
+ typename mpl::if_<
+ mpl::and_<
+ mpl::less_equal<precision_type, mpl::int_<113> >,
+ mpl::greater<precision_type, mpl::int_<0> >
+ >,
+ mpl::int_<113>, mpl::int_<0> >::type
+ >::type tag_type;
+ do_init(tag_type());
+ }
+ static void do_init(const mpl::int_<64>&)
+ {
+ boost::math::lgamma(static_cast<T>(2.5), Policy());
+ boost::math::lgamma(static_cast<T>(1.25), Policy());
+ boost::math::lgamma(static_cast<T>(1.75), Policy());
+ }
+ static void do_init(const mpl::int_<113>&)
+ {
+ boost::math::lgamma(static_cast<T>(2.5), Policy());
+ boost::math::lgamma(static_cast<T>(1.25), Policy());
+ boost::math::lgamma(static_cast<T>(1.5), Policy());
+ boost::math::lgamma(static_cast<T>(1.75), Policy());
+ }
+ static void do_init(const mpl::int_<0>&)
+ {
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy>
+const typename lgamma_initializer<T, Policy>::init lgamma_initializer<T, Policy>::initializer;
+
template <class T1, class T2, class Policy>
inline typename tools::promote_args<T1, T2>::type
tgamma(T1 a, T2 z, const Policy&, const mpl::false_)
@@ -1272,6 +1367,9 @@
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
+
+ igamma_initializer<value_type, forwarding_policy>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::gamma_incomplete_imp(static_cast<value_type>(a),
static_cast<value_type>(z), false, true,
@@ -1285,6 +1383,7 @@
return tgamma(a, z, policies::policy<>(), tag);
}
+
} // namespace detail
template <class T>
@@ -1308,6 +1407,9 @@
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
+
+ detail::lgamma_initializer<value_type, forwarding_policy>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(detail::lgamma_imp(static_cast<value_type>(z), forwarding_policy(), evaluation_type(), sign), "boost::math::lgamma<%1%>(%1%)");
}
@@ -1395,6 +1497,8 @@
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
+ detail::igamma_initializer<value_type, forwarding_policy>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::gamma_incomplete_imp(static_cast<value_type>(a),
static_cast<value_type>(z), false, false,
@@ -1424,6 +1528,8 @@
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
+ detail::igamma_initializer<value_type, forwarding_policy>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::gamma_incomplete_imp(static_cast<value_type>(a),
static_cast<value_type>(z), true, true,
@@ -1453,6 +1559,8 @@
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
+ detail::igamma_initializer<value_type, forwarding_policy>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::gamma_incomplete_imp(static_cast<value_type>(a),
static_cast<value_type>(z), true, false,
Modified: branches/release/boost/math/special_functions/lanczos.hpp
==============================================================================
--- branches/release/boost/math/special_functions/lanczos.hpp (original)
+++ branches/release/boost/math/special_functions/lanczos.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -34,6 +34,35 @@
// http://my.fit.edu/~gabdo/gamma.txt and elaborated by Toth at
// http://www.rskey.org/gamma.htm using NTL::RR at 1000 bit precision.
//
+// Begin with a small helper to force initialization of constants prior
+// to main. This makes the constant initialization thread safe, even
+// when called with a user-defined number type.
+//
+template <class Lanczos, class T>
+struct lanczos_initializer
+{
+ struct init
+ {
+ init()
+ {
+ T t(1);
+ Lanczos::lanczos_sum(t);
+ Lanczos::lanczos_sum_expG_scaled(t);
+ Lanczos::lanczos_sum_near_1(t);
+ Lanczos::lanczos_sum_near_2(t);
+ Lanczos::g();
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+template <class Lanczos, class T>
+typename lanczos_initializer<Lanczos, T>::init const lanczos_initializer<Lanczos, T>::initializer;
+//
// Lanczos Coefficients for N=6 G=5.581
// Max experimental error (with arbitary precision arithmetic) 9.516e-12
// Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006
@@ -47,6 +76,7 @@
template <class T>
static T lanczos_sum(const T& z)
{
+ lanczos_initializer<lanczos6, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[6] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 8706.349592549009182288174442774377925882)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 8523.650341121874633477483696775067709735)),
@@ -69,6 +99,7 @@
template <class T>
static T lanczos_sum_expG_scaled(const T& z)
{
+ lanczos_initializer<lanczos6, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[6] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 32.81244541029783471623665933780748627823)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 32.12388941444332003446077108933558534361)),
@@ -92,6 +123,7 @@
template<class T>
static T lanczos_sum_near_1(const T& dz)
{
+ lanczos_initializer<lanczos6, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[5] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 2.044879010930422922760429926121241330235)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, -2.751366405578505366591317846728753993668)),
@@ -110,6 +142,7 @@
template<class T>
static T lanczos_sum_near_2(const T& dz)
{
+ lanczos_initializer<lanczos6, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[5] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 5.748142489536043490764289256167080091892)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, -7.734074268282457156081021756682138251825)),
@@ -143,6 +176,7 @@
template <class T>
static T lanczos_sum(const T& z)
{
+ lanczos_initializer<lanczos11, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[11] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 38474670393.31776828316099004518914832218)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 36857665043.51950660081971227404959150474)),
@@ -175,6 +209,7 @@
template <class T>
static T lanczos_sum_expG_scaled(const T& z)
{
+ lanczos_initializer<lanczos11, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[11] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 709811.662581657956893540610814842699825)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 679979.847415722640161734319823103390728)),
@@ -208,6 +243,7 @@
template<class T>
static T lanczos_sum_near_1(const T& dz)
{
+ lanczos_initializer<lanczos11, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[10] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 4.005853070677940377969080796551266387954)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, -13.17044315127646469834125159673527183164)),
@@ -231,6 +267,7 @@
template<class T>
static T lanczos_sum_near_2(const T& dz)
{
+ lanczos_initializer<lanczos11, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[10] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 19.05889633808148715159575716844556056056)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, -62.66183664701721716960978577959655644762)),
@@ -269,6 +306,7 @@
template <class T>
static T lanczos_sum(const T& z)
{
+ lanczos_initializer<lanczos13, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[13] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 44012138428004.60895436261759919070125699)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 41590453358593.20051581730723108131357995)),
@@ -305,6 +343,7 @@
template <class T>
static T lanczos_sum_expG_scaled(const T& z)
{
+ lanczos_initializer<lanczos13, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[13] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 86091529.53418537217994842267760536134841)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 81354505.17858011242874285785316135398567)),
@@ -342,6 +381,7 @@
template<class T>
static T lanczos_sum_near_1(const T& dz)
{
+ lanczos_initializer<lanczos13, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[12] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 4.832115561461656947793029596285626840312)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, -19.86441536140337740383120735104359034688)),
@@ -367,6 +407,7 @@
template<class T>
static T lanczos_sum_near_2(const T& dz)
{
+ lanczos_initializer<lanczos13, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[12] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 26.96979819614830698367887026728396466395)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, -110.8705424709385114023884328797900204863)),
@@ -382,7 +423,7 @@
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, -0.9685385411006641478305219367315965391289e-9)),
};
T result = 0;
- T z = z = 2;
+ T z = dz + 2;
for(unsigned k = 1; k <= sizeof(d)/sizeof(d[0]); ++k)
{
result += (-d[k-1]*dz)/(z + k*z + k*k - 1);
@@ -407,6 +448,7 @@
template <class T>
static T lanczos_sum(const T& z)
{
+ lanczos_initializer<lanczos22, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[22] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 46198410803245094237463011094.12173081986)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 43735859291852324413622037436.321513777)),
@@ -461,6 +503,7 @@
template <class T>
static T lanczos_sum_expG_scaled(const T& z)
{
+ lanczos_initializer<lanczos22, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[22] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 6939996264376682180.277485395074954356211)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 6570067992110214451.87201438870245659384)),
@@ -516,6 +559,7 @@
template<class T>
static T lanczos_sum_near_1(const T& dz)
{
+ lanczos_initializer<lanczos22, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[21] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 8.318998691953337183034781139546384476554)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, -63.15415991415959158214140353299240638675)),
@@ -550,6 +594,7 @@
template<class T>
static T lanczos_sum_near_2(const T& dz)
{
+ lanczos_initializer<lanczos22, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[21] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 75.39272007105208086018421070699575462226)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, -572.3481967049935412452681346759966390319)),
@@ -830,6 +875,7 @@
template <class T>
static T lanczos_sum(const T& z)
{
+ lanczos_initializer<lanczos17m64, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[17] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 553681095419291969.2230556393350368550504)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 731918863887667017.2511276782146694632234)),
@@ -874,6 +920,7 @@
template <class T>
static T lanczos_sum_expG_scaled(const T& z)
{
+ lanczos_initializer<lanczos17m64, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[17] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2715894658327.717377557655133124376674911)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3590179526097.912105038525528721129550434)),
@@ -919,6 +966,7 @@
template<class T>
static T lanczos_sum_near_1(const T& dz)
{
+ lanczos_initializer<lanczos17m64, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[16] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.493645054286536365763334986866616581265)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -16.95716370392468543800733966378143997694)),
@@ -948,6 +996,7 @@
template<class T>
static T lanczos_sum_near_2(const T& dz)
{
+ lanczos_initializer<lanczos17m64, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[16] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 23.56409085052261327114594781581930373708)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -88.92116338946308797946237246006238652361)),
@@ -991,6 +1040,7 @@
template <class T>
static T lanczos_sum(const T& z)
{
+ lanczos_initializer<lanczos24m113, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[24] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 113, 2029889364934367661624137213253.22102954656825019111612712252027267955023987678816620961507)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 113, 2338599599286656537526273232565.2727349714338768161421882478417543004440597874814359063158)),
@@ -1049,6 +1099,7 @@
template <class T>
static T lanczos_sum_expG_scaled(const T& z)
{
+ lanczos_initializer<lanczos24m113, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T num[24] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 113, 3035162425359883494754.02878223286972654682199012688209026810841953293372712802258398358538)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 113, 3496756894406430103600.16057175075063458536101374170860226963245118484234495645518505519827)),
@@ -1108,6 +1159,7 @@
template<class T>
static T lanczos_sum_near_1(const T& dz)
{
+ lanczos_initializer<lanczos24m113, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[23] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 113, 7.4734083002469026177867421609938203388868806387315406134072298925733950040583068760685908)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 113, -50.4225805042247530267317342133388132970816607563062253708655085754357843064134941138154171)),
@@ -1144,6 +1196,7 @@
template<class T>
static T lanczos_sum_near_2(const T& dz)
{
+ lanczos_initializer<lanczos24m113, T>::force_instantiate(); // Ensure our constants get initialized before main()
static const T d[23] = {
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 113, 61.4165001061101455341808888883960361969557848005400286332291451422461117307237198559485365)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 113, -414.372973678657049667308134761613915623353625332248315105320470271523320700386200587519147)),
Modified: branches/release/boost/math/special_functions/log1p.hpp
==============================================================================
--- branches/release/boost/math/special_functions/log1p.hpp (original)
+++ branches/release/boost/math/special_functions/log1p.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -258,6 +258,34 @@
return result;
}
+template <class T, class Policy, class tag>
+struct log1p_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init(tag());
+ }
+ template <int N>
+ static void do_init(const mpl::int_<N>&){}
+ static void do_init(const mpl::int_<64>&)
+ {
+ boost::math::log1p(static_cast<T>(0.25), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy, class tag>
+const typename log1p_initializer<T, Policy, tag>::init log1p_initializer<T, Policy, tag>::initializer;
+
+
} // namespace detail
template <class T, class Policy>
@@ -286,6 +314,9 @@
>::type
>::type
>::type tag_type;
+
+ detail::log1p_initializer<value_type, forwarding_policy, tag_type>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::log1p_imp(static_cast<value_type>(x), forwarding_policy(), tag_type()), "boost::math::log1p<%1%>(%1%)");
}
Modified: branches/release/boost/math/special_functions/math_fwd.hpp
==============================================================================
--- branches/release/boost/math/special_functions/math_fwd.hpp (original)
+++ branches/release/boost/math/special_functions/math_fwd.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -28,6 +28,7 @@
#include <boost/math/policies/policy.hpp>
#include <boost/mpl/comparison.hpp>
#include <boost/config/no_tr1/complex.hpp>
+#include <complex>
#define BOOST_NO_MACRO_EXPAND /**/
@@ -614,6 +615,30 @@
template <class T>
typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_neumann(unsigned v, T x);
+ template <class T1, class T2, class Policy>
+ std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol);
+
+ template <class T1, class T2>
+ std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> cyl_hankel_1(T1 v, T2 x);
+
+ template <class T1, class T2, class Policy>
+ std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_2(T1 v, T2 x, const Policy& pol);
+
+ template <class T1, class T2>
+ std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> cyl_hankel_2(T1 v, T2 x);
+
+ template <class T1, class T2, class Policy>
+ std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> sph_hankel_1(T1 v, T2 x, const Policy& pol);
+
+ template <class T1, class T2>
+ std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> sph_hankel_1(T1 v, T2 x);
+
+ template <class T1, class T2, class Policy>
+ std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> sph_hankel_2(T1 v, T2 x, const Policy& pol);
+
+ template <class T1, class T2>
+ std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> sph_hankel_2(T1 v, T2 x);
+
template <class T, class Policy>
typename tools::promote_args<T>::type sin_pi(T x, const Policy&);
@@ -681,6 +706,13 @@
template <class T, class Policy>
typename tools::promote_args<T>::type zeta(T s, const Policy&);
+ // Owen's T function:
+ template <class T1, class T2, class Policy>
+ typename tools::promote_args<T1, T2>::type owens_t(T1 h, T2 a, const Policy& pol);
+
+ template <class T1, class T2>
+ typename tools::promote_args<T1, T2>::type owens_t(T1 h, T2 a);
+
template <class T>
typename tools::promote_args<T>::type zeta(T s);
@@ -1063,6 +1095,26 @@
template <class T> T float_next(const T& a){ return boost::math::float_next(a, Policy()); }\
template <class T> T float_prior(const T& a){ return boost::math::float_prior(a, Policy()); }\
template <class T> T float_distance(const T& a, const T& b){ return boost::math::float_distance(a, b, Policy()); }\
+ \
+ template <class RT1, class RT2>\
+ inline typename boost::math::tools::promote_args<RT1, RT2>::type owens_t(RT1 a, RT2 z){ return boost::math::owens_t(a, z, Policy()); }\
+ \
+ template <class T1, class T2>\
+ inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> cyl_hankel_1(T1 v, T2 x)\
+ { return boost::math::cyl_hankel_1(v, x, Policy()); }\
+ \
+ template <class T1, class T2>\
+ inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> cyl_hankel_2(T1 v, T2 x)\
+ { return boost::math::cyl_hankel_2(v, x, Policy()); }\
+ \
+ template <class T1, class T2>\
+ inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> sph_hankel_1(T1 v, T2 x)\
+ { return boost::math::sph_hankel_1(v, x, Policy()); }\
+ \
+ template <class T1, class T2>\
+ inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> sph_hankel_2(T1 v, T2 x)\
+ { return boost::math::sph_hankel_2(v, x, Policy()); }\
+
#endif // BOOST_MATH_SPECIAL_MATH_FWD_HPP
Modified: branches/release/boost/math/special_functions/nonfinite_num_facets.hpp
==============================================================================
--- branches/release/boost/math/special_functions/nonfinite_num_facets.hpp (original)
+++ branches/release/boost/math/special_functions/nonfinite_num_facets.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,8 +1,9 @@
#ifndef BOOST_MATH_NONFINITE_NUM_FACETS_HPP
#define BOOST_MATH_NONFINITE_NUM_FACETS_HPP
-// Copyright (c) 2006 Johan Rade
-// Copyright 2011 Paul A. Bristow (comments)
+// Copyright 2006 Johan Rade
+// Copyright 2012 K R Walker
+// Copyright 2011, 2012 Paul A. Bristow
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
@@ -28,10 +29,9 @@
#include <boost/math/special_functions/sign.hpp>
#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable : 4127) // conditional expression is constant.
-# pragma warning(disable : 4706) // assignment within conditional expression.
-# pragma warning(disable : 4224) // formal parameter 'version' was previously defined as a type.
+# pragma warning(push)
+# pragma warning(disable : 4127) // conditional expression is constant.
+# pragma warning(disable : 4706) // assignment within conditional expression.
#endif
namespace boost {
@@ -65,16 +65,14 @@
protected:
virtual OutputIterator do_put(
- OutputIterator it, std::ios_base& iosb,
- CharType fill, double val) const
+ OutputIterator it, std::ios_base& iosb, CharType fill, double val) const
{
put_and_reset_width(it, iosb, fill, val);
return it;
}
virtual OutputIterator do_put(
- OutputIterator it, std::ios_base& iosb,
- CharType fill, long double val) const
+ OutputIterator it, std::ios_base& iosb, CharType fill, long double val) const
{
put_and_reset_width(it, iosb, fill, val);
return it;
@@ -93,86 +91,136 @@
OutputIterator& it, std::ios_base& iosb,
CharType fill, ValType val) const
{
- switch((boost::math::fpclassify)(val)) {
+ static const CharType prefix_plus[2] = { '+', '\0' };
+ static const CharType prefix_minus[2] = { '-', '\0' };
+ static const CharType body_inf[4] = { 'i', 'n', 'f', '\0' };
+ static const CharType body_nan[4] = { 'n', 'a', 'n', '\0' };
+ static const CharType* null_string = 0;
+
+ switch((boost::math::fpclassify)(val))
+ {
case FP_INFINITE:
if(flags_ & trap_infinity)
+ {
throw std::ios_base::failure("Infinity");
+ }
else if((boost::math::signbit)(val))
- put_num_and_fill(it, iosb, "-", "inf", fill);
+ { // negative infinity.
+ put_num_and_fill(it, iosb, prefix_minus, body_inf, fill, val);
+ }
else if(iosb.flags() & std::ios_base::showpos)
- put_num_and_fill(it, iosb, "+", "inf", fill);
+ { // Explicit "+inf" wanted.
+ put_num_and_fill(it, iosb, prefix_plus, body_inf, fill, val);
+ }
else
- put_num_and_fill(it, iosb, "", "inf", fill);
+ { // just "inf" wanted.
+ put_num_and_fill(it, iosb, null_string, body_inf, fill, val);
+ }
break;
case FP_NAN:
if(flags_ & trap_nan)
+ {
throw std::ios_base::failure("NaN");
+ }
else if((boost::math::signbit)(val))
- put_num_and_fill(it, iosb, "-", "nan", fill);
+ { // negative so "-nan".
+ put_num_and_fill(it, iosb, prefix_minus, body_nan, fill, val);
+ }
else if(iosb.flags() & std::ios_base::showpos)
- put_num_and_fill(it, iosb, "+", "nan", fill);
+ { // explicit "+nan" wanted.
+ put_num_and_fill(it, iosb, prefix_plus, body_nan, fill, val);
+ }
else
- put_num_and_fill(it, iosb, "", "nan", fill);
+ { // Just "nan".
+ put_num_and_fill(it, iosb, null_string, body_nan, fill, val);
+ }
break;
case FP_ZERO:
- if(flags_ & signed_zero) {
- if((boost::math::signbit)(val))
- put_num_and_fill(it, iosb, "-", "0", fill);
- else if(iosb.flags() & std::ios_base::showpos)
- put_num_and_fill(it, iosb, "+", "0", fill);
- else
- put_num_and_fill(it, iosb, "", "0", fill);
+ if((flags_ & signed_zero) && ((boost::math::signbit)(val)))
+ { // Flag set to distinguish between positive and negative zero.
+ // But string "0" should have stuff after decimal point if setprecision and/or exp format.
+
+ std::basic_ostringstream<CharType> zeros; // Needs to be CharType version.
+
+ // Copy flags, fill, width and precision.
+ zeros.flags(iosb.flags());
+ zeros.unsetf(std::ios::showpos); // Ignore showpos because must be negative.
+ zeros.precision(iosb.precision());
+ //zeros.width is set by put_num_and_fill
+ zeros.fill(static_cast<char>(fill));
+ zeros << ValType(0);
+ put_num_and_fill(it, iosb, prefix_minus, zeros.str().c_str(), fill, val);
}
else
- put_num_and_fill(it, iosb, "", "0", fill);
+ { // Output the platform default for positive and negative zero.
+ put_num_and_fill(it, iosb, null_string, null_string, fill, val);
+ }
break;
- default:
- it = std::num_put<CharType, OutputIterator>::do_put(
- it, iosb, fill, val);
+ default: // Normal non-zero finite value.
+ it = std::num_put<CharType, OutputIterator>::do_put(it, iosb, fill, val);
break;
}
}
+ template<class ValType>
void put_num_and_fill(
- OutputIterator& it, std::ios_base& iosb, const char* prefix,
- const char* body, CharType fill) const
+ OutputIterator& it, std::ios_base& iosb, const CharType* prefix,
+ const CharType* body, CharType fill, ValType val) const
{
- int width = (int)std::strlen(prefix) + (int)std::strlen(body);
- std::ios_base::fmtflags adjust
- = iosb.flags() & std::ios_base::adjustfield;
+ int prefix_length = prefix ? (int)std::char_traits<CharType>::length(prefix) : 0;
+ int body_length = body ? (int)std::char_traits<CharType>::length(body) : 0;
+ int width = prefix_length + body_length;
+ std::ios_base::fmtflags adjust = iosb.flags() & std::ios_base::adjustfield;
const std::ctype<CharType>& ct
= std::use_facet<std::ctype<CharType> >(iosb.getloc());
- if(adjust != std::ios_base::internal && adjust != std::ios_base::left)
- put_fill(it, iosb, fill, width);
-
- while(*prefix)
- *it = ct.widen(*(prefix++));
-
- if(adjust == std::ios_base::internal)
- put_fill(it, iosb, fill, width);
+ if(body || prefix)
+ { // adjust == std::ios_base::right, so leading fill needed.
+ if(adjust != std::ios_base::internal && adjust != std::ios_base::left)
+ put_fill(it, iosb, fill, width);
+ }
+
+ if(prefix)
+ { // Adjust width for prefix.
+ while(*prefix)
+ *it = *(prefix++);
+ iosb.width( iosb.width() - prefix_length );
+ width -= prefix_length;
+ }
+
+ if(body)
+ { //
+ if(adjust == std::ios_base::internal)
+ { // Put fill between sign and digits.
+ put_fill(it, iosb, fill, width);
+ }
+ if(iosb.flags() & std::ios_base::uppercase)
+ {
+ while(*body)
+ *it = ct.toupper(*(body++));
+ }
+ else
+ {
+ while(*body)
+ *it = *(body++);
+ }
- if(iosb.flags() & std::ios_base::uppercase) {
- while(*body)
- *it = ct.toupper(ct.widen(*(body++)));
+ if(adjust == std::ios_base::left)
+ put_fill(it, iosb, fill, width);
}
- else {
- while(*body)
- *it = ct.widen(*(body++));
+ else
+ {
+ it = std::num_put<CharType, OutputIterator>::do_put(it, iosb, fill, val);
}
-
- if(adjust == std::ios_base::left)
- put_fill(it, iosb, fill, width);
}
void put_fill(
- OutputIterator& it, std::ios_base& iosb,
- CharType fill, int width) const
- {
+ OutputIterator& it, std::ios_base& iosb, CharType fill, int width) const
+ { // Insert fill chars.
for(std::streamsize i = iosb.width() - static_cast<std::streamsize>(width); i > 0; --i)
*it = fill;
}
@@ -540,4 +588,5 @@
# pragma warning(pop)
#endif
-#endif
+#endif // BOOST_MATH_NONFINITE_NUM_FACETS_HPP
+
Modified: branches/release/boost/math/special_functions/round.hpp
==============================================================================
--- branches/release/boost/math/special_functions/round.hpp (original)
+++ branches/release/boost/math/special_functions/round.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -76,7 +76,7 @@
BOOST_MATH_STD_USING
T r = boost::math::round(v, pol);
if((r > (std::numeric_limits<boost::long_long_type>::max)()) || (r < (std::numeric_limits<boost::long_long_type>::min)()))
- return static_cast<boost::long_long_type>(policies::raise_rounding_error("boost::math::llround<%1%>(%1%)", 0, v, 0LL, pol));
+ return static_cast<boost::long_long_type>(policies::raise_rounding_error("boost::math::llround<%1%>(%1%)", 0, v, static_cast<boost::long_long_type>(0), pol));
return static_cast<boost::long_long_type>(r);
}
template <class T>
Modified: branches/release/boost/math/special_functions/trunc.hpp
==============================================================================
--- branches/release/boost/math/special_functions/trunc.hpp (original)
+++ branches/release/boost/math/special_functions/trunc.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -76,7 +76,7 @@
BOOST_MATH_STD_USING
T r = boost::math::trunc(v, pol);
if((r > (std::numeric_limits<boost::long_long_type>::max)()) || (r < (std::numeric_limits<boost::long_long_type>::min)()))
- return static_cast<boost::long_long_type>(policies::raise_rounding_error("boost::math::lltrunc<%1%>(%1%)", 0, v, 0LL, pol));
+ return static_cast<boost::long_long_type>(policies::raise_rounding_error("boost::math::lltrunc<%1%>(%1%)", 0, v, static_cast<boost::long_long_type>(0), pol));
return static_cast<boost::long_long_type>(r);
}
template <class T>
Modified: branches/release/boost/math/special_functions/zeta.hpp
==============================================================================
--- branches/release/boost/math/special_functions/zeta.hpp (original)
+++ branches/release/boost/math/special_functions/zeta.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -542,7 +542,7 @@
}
template <class T, class Policy>
-T zeta_imp_prec(T s, T sc, const Policy& pol, const mpl::int_<113>&)
+T zeta_imp_prec(T s, T sc, const Policy&, const mpl::int_<113>&)
{
BOOST_MATH_STD_USING
T result;
@@ -896,6 +896,49 @@
return result;
}
+template <class T, class Policy, class tag>
+struct zeta_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init(tag());
+ }
+ static void do_init(const mpl::int_<0>&){}
+ static void do_init(const mpl::int_<53>&){}
+ static void do_init(const mpl::int_<64>&)
+ {
+ boost::math::zeta(static_cast<T>(0.5), Policy());
+ boost::math::zeta(static_cast<T>(1.5), Policy());
+ boost::math::zeta(static_cast<T>(3.5), Policy());
+ boost::math::zeta(static_cast<T>(6.5), Policy());
+ boost::math::zeta(static_cast<T>(14.5), Policy());
+ boost::math::zeta(static_cast<T>(40.5), Policy());
+ }
+ static void do_init(const mpl::int_<113>&)
+ {
+ boost::math::zeta(static_cast<T>(0.5), Policy());
+ boost::math::zeta(static_cast<T>(1.5), Policy());
+ boost::math::zeta(static_cast<T>(3.5), Policy());
+ boost::math::zeta(static_cast<T>(5.5), Policy());
+ boost::math::zeta(static_cast<T>(9.5), Policy());
+ boost::math::zeta(static_cast<T>(16.5), Policy());
+ boost::math::zeta(static_cast<T>(25), Policy());
+ boost::math::zeta(static_cast<T>(70), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy, class tag>
+const typename zeta_initializer<T, Policy, tag>::init zeta_initializer<T, Policy, tag>::initializer;
+
} // detail
template <class T, class Policy>
@@ -929,6 +972,8 @@
>::type tag_type;
//typedef mpl::int_<0> tag_type;
+ detail::zeta_initializer<value_type, forwarding_policy, tag_type>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(detail::zeta_imp(
static_cast<value_type>(s),
static_cast<value_type>(1 - static_cast<value_type>(s)),
Modified: branches/release/boost/math/tools/big_constant.hpp
==============================================================================
--- branches/release/boost/math/tools/big_constant.hpp (original)
+++ branches/release/boost/math/tools/big_constant.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -11,15 +11,17 @@
#include <boost/lexical_cast.hpp>
#include <boost/type_traits/is_convertible.hpp>
-namespace boost{ namespace math{ namespace tools{
+namespace boost{ namespace math{
+
+namespace tools{
template <class T>
-inline T make_big_value(long double v, const char*, mpl::true_ const&, mpl::false_ const&)
+inline BOOST_CONSTEXPR_OR_CONST T make_big_value(long double v, const char*, mpl::true_ const&, mpl::false_ const&)
{
return static_cast<T>(v);
}
template <class T>
-inline T make_big_value(long double v, const char*, mpl::true_ const&, mpl::true_ const&)
+inline BOOST_CONSTEXPR_OR_CONST T make_big_value(long double v, const char*, mpl::true_ const&, mpl::true_ const&)
{
return static_cast<T>(v);
}
@@ -29,7 +31,7 @@
return boost::lexical_cast<T>(s);
}
template <class T>
-inline const char* make_big_value(long double, const char* s, mpl::false_ const&, mpl::true_ const&)
+inline BOOST_CONSTEXPR const char* make_big_value(long double, const char* s, mpl::false_ const&, mpl::true_ const&)
{
return s;
}
@@ -38,7 +40,15 @@
// For constants which might fit in a long double (if it's big enough):
//
#define BOOST_MATH_BIG_CONSTANT(T, D, x)\
- boost::math::tools::make_big_value<T>(BOOST_JOIN(x, L), BOOST_STRINGIZE(x), mpl::bool_<D <= std::numeric_limits<long double>::digits>(), boost::is_convertible<const char*, T>())
+ boost::math::tools::make_big_value<T>(\
+ BOOST_JOIN(x, L), \
+ BOOST_STRINGIZE(x), \
+ mpl::bool_< (is_convertible<long double, T>::value) && \
+ ((D <= std::numeric_limits<long double>::digits) \
+ || is_floating_point<T>::value \
+ || (std::numeric_limits<T>::is_specialized && \
+ (std::numeric_limits<T>::digits10 <= std::numeric_limits<long double>::digits10))) >(), \
+ boost::is_convertible<const char*, T>())
//
// For constants too huge for any conceivable long double (and which generate compiler errors if we try and declare them as such):
//
Modified: branches/release/boost/math/tools/config.hpp
==============================================================================
--- branches/release/boost/math/tools/config.hpp (original)
+++ branches/release/boost/math/tools/config.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -16,6 +16,7 @@
#include <algorithm> // for min and max
#include <boost/config/no_tr1/cmath.hpp>
#include <climits>
+#include <cfloat>
#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
# include <math.h>
#endif
@@ -24,7 +25,8 @@
#include <boost/math/special_functions/detail/round_fwd.hpp>
#if (defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__NetBSD__) \
- || (defined(__hppa) && !defined(__OpenBSD__)) || defined(__NO_LONG_DOUBLE_MATH)) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
+ || (defined(__hppa) && !defined(__OpenBSD__)) || (defined(__NO_LONG_DOUBLE_MATH) && (DBL_MANT_DIG != LDBL_MANT_DIG))) \
+ && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
@@ -38,6 +40,13 @@
# define BOOST_MATH_CONTROL_FP _control87(MCW_EM,MCW_EM)
# include <float.h>
#endif
+#ifdef __IBMCPP__
+//
+// For reasons I don't unserstand, the tests with IMB's compiler all
+// pass at long double precision, but fail with real_concept, those tests
+// are disabled for now. (JM 2012).
+# define BOOST_MATH_NO_REAL_CONCEPT_TESTS
+#endif
#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
//
// Darwin's rather strange "double double" is rather hard to
Modified: branches/release/boost/math/tools/precision.hpp
==============================================================================
--- branches/release/boost/math/tools/precision.hpp (original)
+++ branches/release/boost/math/tools/precision.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -195,7 +195,7 @@
(std::numeric_limits<T>::max_exponent == 128
|| std::numeric_limits<T>::max_exponent == 1024
|| std::numeric_limits<T>::max_exponent == 16384),
- mpl::int_<std::numeric_limits<T>::max_exponent>,
+ mpl::int_<(std::numeric_limits<T>::max_exponent > INT_MAX ? INT_MAX : static_cast<int>(std::numeric_limits<T>::max_exponent))>,
mpl::int_<0>
>::type tag_type;
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -217,7 +217,7 @@
(std::numeric_limits<T>::max_exponent == 128
|| std::numeric_limits<T>::max_exponent == 1024
|| std::numeric_limits<T>::max_exponent == 16384),
- mpl::int_<std::numeric_limits<T>::max_exponent>,
+ mpl::int_<(std::numeric_limits<T>::max_exponent > INT_MAX ? INT_MAX : static_cast<int>(std::numeric_limits<T>::max_exponent))>,
mpl::int_<0>
>::type tag_type;
Modified: branches/release/boost/math/tools/test.hpp
==============================================================================
--- branches/release/boost/math/tools/test.hpp (original)
+++ branches/release/boost/math/tools/test.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -255,6 +255,74 @@
return result;
}
+template <class Real, class A, class F1, class F2>
+test_result<Real> test_hetero(const A& a, F1 test_func, F2 expect_func)
+{
+ typedef typename A::value_type row_type;
+ typedef Real value_type;
+
+ test_result<value_type> result;
+
+ for(unsigned i = 0; i < a.size(); ++i)
+ {
+ const row_type& row = a[i];
+ value_type point;
+ try
+ {
+ point = test_func(row);
+ }
+ catch(const std::underflow_error&)
+ {
+ point = 0;
+ }
+ catch(const std::overflow_error&)
+ {
+ point = std::numeric_limits<value_type>::has_infinity ?
+ std::numeric_limits<value_type>::infinity()
+ : tools::max_value<value_type>();
+ }
+ catch(const std::exception& e)
+ {
+ std::cerr << e.what() << std::endl;
+ print_row(row);
+ BOOST_ERROR("Unexpected exception.");
+ // so we don't get further errors:
+ point = expect_func(row);
+ }
+ value_type expected = expect_func(row);
+ value_type err = relative_error(point, expected);
+#ifdef BOOST_INSTRUMENT
+ if(err != 0)
+ {
+ std::cout << row[0] << " " << err;
+ if(std::numeric_limits<value_type>::is_specialized)
+ {
+ std::cout << " (" << err / std::numeric_limits<value_type>::epsilon() << "eps)";
+ }
+ std::cout << std::endl;
+ }
+#endif
+ if(!(boost::math::isfinite)(point) && (boost::math::isfinite)(expected))
+ {
+ std::cout << "CAUTION: Found non-finite result, when a finite value was expected at entry " << i << "\n";
+ std::cout << "Found: " << point << " Expected " << expected << " Error: " << err << std::endl;
+ print_row(row);
+ BOOST_ERROR("Unexpected non-finite result");
+ }
+ if(err > 0.5)
+ {
+ std::cout << "CAUTION: Gross error found at entry " << i << ".\n";
+ std::cout << "Found: " << point << " Expected " << expected << " Error: " << err << std::endl;
+ print_row(row);
+ BOOST_ERROR("Gross error");
+ }
+ result.add(err);
+ if((result.max)() == err)
+ result.set_worst(i);
+ }
+ return result;
+}
+
} // namespace tools
} // namespace math
} // namespace boost
Modified: branches/release/boost/math/tools/test_data.hpp
==============================================================================
--- branches/release/boost/math/tools/test_data.hpp (original)
+++ branches/release/boost/math/tools/test_data.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -726,7 +726,7 @@
if(a == b)
return os;
- os << "#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))\n"
+ os << "#ifndef SC_\n# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))\n#endif\n"
" static const boost::array<boost::array<T, "
<< a->size() << ">, " << data.size() << "> " << name << " = {{\n";
@@ -749,7 +749,7 @@
os << " }";
++a;
}
- os << "\n }};\n#undef SC_\n\n";
+ os << "\n }};\n//#undef SC_\n\n";
return os;
}
Modified: branches/release/boost/math/tr1.hpp
==============================================================================
--- branches/release/boost/math/tr1.hpp (original)
+++ branches/release/boost/math/tr1.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -104,6 +104,7 @@
# include <boost/config/auto_link.hpp>
#endif
+#if !(defined(BOOST_INTEL) && defined(__APPLE__)) && !(defined(__FLT_EVAL_METHOD__) && !defined(__cplusplus))
#ifndef FLT_EVAL_METHOD
typedef float float_t;
typedef double double_t;
@@ -117,6 +118,7 @@
typedef long double float_t;
typedef long double double_t;
#endif
+#endif
// C99 Functions:
double BOOST_MATH_TR1_DECL boost_acosh BOOST_PREVENT_MACRO_SUBSTITUTION(double x) BOOST_MATH_C99_THROW_SPEC;
Modified: branches/release/libs/math/build/Jamfile.v2
==============================================================================
--- branches/release/libs/math/build/Jamfile.v2 (original)
+++ branches/release/libs/math/build/Jamfile.v2 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -16,7 +16,7 @@
#<toolset>gcc:<cxxflags>-fvisibility=hidden
<toolset>intel-linux:<cxxflags>-fvisibility=hidden
<toolset>sun:<cxxflags>-xldscope=hidden
- [ check-target-builds ../config//has_gcc_visibility : <toolset>gcc:<cxxflags>-fvisibility=hidden : ]
+ [ check-target-builds ../config//has_gcc_visibility "gcc visibility" : <toolset>gcc:<cxxflags>-fvisibility=hidden : ]
;
cpp-pch pch : ../src/tr1/pch.hpp : <include>../src/tr1 <link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1 ;
@@ -96,7 +96,7 @@
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
<dependency>../config//has_long_double_support
<include>../src/tr1
- [ check-target-builds ../config//has_long_double_support : : <build>no ]
+ [ check-target-builds ../config//has_long_double_support "long double support" : : <build>no ]
;
lib boost_math_c99 : ../src/tr1/$(C99_SOURCES).cpp pch
@@ -116,7 +116,7 @@
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
<dependency>../config//has_long_double_support
<include>../src/tr1
- [ check-target-builds ../config//has_long_double_support : : <build>no ]
+ [ check-target-builds ../config//has_long_double_support "long double support" : : <build>no ]
;
boost-install boost_math_c99 boost_math_c99f boost_math_c99l boost_math_tr1 boost_math_tr1f boost_math_tr1l ;
Modified: branches/release/libs/math/doc/sf_and_dist/constants.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/constants.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/constants.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,75 +1,710 @@
-[section:constants Numeric Constants]
+[section:constants Mathematical Constants]
-[h4 Synopsis]
+[section:intro Introduction]
+Boost.Math provides a collection of mathematical constants.
+
+[h4 Why use Boost.Math mathematical constants?]
+
+* Readable. For the very many jobs just using built-in like `double`, you can just write expressions like
+``double area = pi * r * r;``
+(If that's all you want, jump direct to [link math_toolkit.constants.tutorial.non_templ use in non-template code]!)
+* Effortless - avoiding a search of reference sources.
+* Usable with both builtin floating point types, and user-defined, possibly extended precision, types such as
+NTL, MPFR/GMP, mp_float: in the latter case the constants are computed to the necessary precision and then cached.
+* Accurate - ensuring that the values are as accurate as possible for the
+chosen floating-point type
+ * No loss of accuracy from repeated rounding of intermediate computations.
+ * Result is computed with higher precision and only rounded once.
+ * Less risk of inaccurate result from functions pow, trig and log at [@http://en.wikipedia.org/wiki/Corner_case corner cases].
+ * Less risk of [@http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html cancellation error].
+* Faster - can avoid (re-)calculation at runtime. This can be significant if:
+ * Functions pow, trig or log are used.
+ * Inside an inner loop.
+ * Using a high-precision UDT.
+ * Compiler optimizations possible with built-in types, especially `double`, are not available.
+* Portable - as possible between different systems using different floating-point precisions:
+see [link math_toolkit.constants.tutorial.templ use in template code].
+* Tested - by comparison with other published sources, or separately computed at long double precision.
+
+[endsect] [/section:intro Introduction]
+
+[section:tutorial Tutorial]
+
+[section:non_templ Use in non-template code]
+
+When using the math constants at your chosen fixed precision in non-template code,
+you can simply add a `using` declaration, for example, `using boost::math::double_constants`,
+to make the constants of the correct precision for your code
+visible in the current scope, and then use each constant ['as a simple variable]:
+
+ #include <boost/math/constants.hpp>
+
+ double area(double r)
+ {
+ using boost::math::double_constants;
+ return pi * r * r;
+ }
+
+Had our function been written as taking a `float` rather than a `double`,
+we could have written instead:
+
+ #include <boost/math/constants.hpp>
+
+ float area(float r)
+ {
+ using boost::math::float_constants;
+ return pi * r * r;
+ }
+
+Likewise, constants that are suitable for use at `long double` precision
+are available in the namespace `boost::math::long_double_constants`.
+
+You can see the full list of available constants at [link math_toolkit.constants.constants].
+
+[endsect]
+
+[section:templ Use in template code]
+
+When using the constants inside a function template, we need to ensure that
+we use a constant of the correct precision for our template parameters.
+We can do this by calling the function-template versions, `pi<FPType>()`, of the constants
+like this:
+
+ #include <boost/math/constants.hpp>
+
+ template <class Real>
+ Real area(Real r)
+ {
+ using namespace boost::math::constants;
+ return pi<Real>() * r * r;
+ }
+
+Although this syntax is a little less "cute" than the non-template version,
+the code is no less efficient
+(at least for the built-in types `float`, `double` and `long double`) :
+the function template versions of the constants are simple inline functions that
+return a constant of the correct precision for the type used. In addition, these
+functions are declared `constexp` for those compilers that support this, allowing
+the result to be used in constant-expressions provided the template argument is a literal type.
+
+[tip Keep in mind the difference between the variable version,
+just `pi`, and the template-function version:
+the template-function requires both a <[~floating-point-type]>
+and function call `()` brackets, for example: `pi<double>()`.
+You cannot write `double p = pi<>()`, nor `double p = pi()`.]
+
+[note You can always use [*both] variable and template-function versions
+[*provided calls are fully qualified], for example:
``
-#include <boost/math/constants/constants.hpp>
+double my_pi1 = boost::math::constants::pi<double>();
+double my_pi2 = boost::math::double_constants::pi;
``
+]
+
+[warning It may be tempting to simply define
+``
+using namespace boost::math::double_constants;
+using namespace boost::math::constants;
+``
+but if you do define two namespaces, this will, of course, create ambiguity!
+``
+double my_pi = pi(); // error C2872: 'pi' : ambiguous symbol
+double my_pi2 = pi; // Context does not allow for disambiguation of overloaded function
+``
+Although the mistake above is fairly obvious,
+it is also not too difficult to do this accidentally, or worse, create it in someone elses code.
+
+Therefore is it prudent to avoid this risk by [*localising the scope of such definitions], as shown above.]
+
+[tip Be very careful with the type provided as parameter.
+For example, providing an [*integer] instead of a floating-point type can be disastrous (a C++ feature).
+
+``cout << "Area = " << area(2) << endl; // Area = 12!!!``
+
+You should get a compiler warning
+[pre
+warning : 'return' : conversion from 'double' to 'int', possible loss of data
+] [/pre]
+Failure to heed this warning can lead to very wrong answers!
+
+You can also avoid this by being explicit about the type of `Area`.
+``cout << "Area = " << area<double>(2) << endl; // Area = 12.566371``
+]
+
+[endsect] [/section:templ Use in template code]
+
+[section:user_def Use With User Defined Types]
+
+The syntax for using the function-call constants with user-defined types is the same
+as it is in the template class, which is to say we use:
+
+ #include <boost/math/constants.hpp>
+
+ boost::math::constants::pi<UserDefinedType>();
+
+However, since the precision of the user-defined type may be much greater than that
+of the built-in floating pointer types, how the value returned is created is as follows:
+
+* If the precision of the type is known at compile time:
+ * If the precision is less than or equal to that of a `float` and the type is constructable from a `float`
+ then our code returns a `float` literal. If the user-defined type is a literal type
+ then the function call that returns the constant will be a `constexp`.
+ * If the precision is less than or equal to that of a `double` and the type is constructable from a `double`
+ then our code returns a `double` literal. If the user-defined type is a literal type
+ then the function call that returns the constant will be a `constexp`.
+ * If the precision is less than or equal to that of a `long double` and the type is constructable from a `long double`
+ then our code returns a `long double` literal. If the user-defined type is a literal type
+ then the function call that returns the constant will be a `constexp`.
+ * If the precision is less than 100 decimal digits, then the constant will be constructed
+ (just the once, then cached in a thread-safe manner) from a string representation of the constant.
+ * Otherwise the value is computed (just once, then cached in a thread-safe manner).
+* If the precision is unknown at compile time then:
+ * If the runtime precision (obtained from a call to `boost::math::tools::digits<T>()`) is
+ less than 100 decimal digits, then the constant is constructed "on the fly" from the string
+ representation of the constant.
+ * Otherwise the value is constructed "on the fly" by calculating then value of the constant
+ using the current default precision of the type. Note that this can make use of the constants
+ rather expensive.
+
+In addition, it is possible to pass a `Policy` type as a second template argument, and use this to control
+the precision:
+
+ #include <boost/math/constants/constants.hpp>
+
+ typedef boost::math::policies::policy<boost::math::policies::digits2<80> > my_policy_type;
+ boost::math::constants::pi<MyType, my_policy_type>();
+
+[note Boost.Math doesn't know how to control the internal precision of `MyType`, the policy
+just controls how the selection process above is carried out, and the calculation precision
+if the result is computed.]
+
+It is also possible to control which method is used to construct the constant by specialising
+the traits class `construction_traits`:
+
+ namespace boost{ namespace math{ namespace constant{
+
+ template <class T, class Policy>
+ struct construction_traits
+ {
+ typedef mpl::int_<N> type;
+ };
- namespace boost{ namespace math{ namespace constants{
-
- template <class T> T pi();
- template <class T> T root_pi();
- template <class T> T root_half_pi();
- template <class T> T root_two_pi();
- template <class T> T root_ln_four();
- template <class T> T e();
- template <class T> T half();
- template <class T> T euler();
- template <class T> T root_two();
- template <class T> T ln_two();
- template <class T> T ln_ln_two();
- template <class T> T third();
- template <class T> T twothirds();
- template <class T> T pi_minus_three();
- template <class T> T four_minus_pi();
-
}}} // namespaces
-[h4 Description]
+Where ['N] takes one of the following values:
+
+[table
+[[['N]][Meaning]]
+[[0][The precision is unavailable at compile time;
+either construct from a decimal digit string or calculate on the fly depending upon the runtime precision.]]
+[[1][Return a float precision constant.]]
+[[2][Return a double precision constant.]]
+[[3][Return a long double precision constant.]]
+[[4][Construct the result from the string representation, and cache the result.]]
+[[Any other value ['N]][Sets the compile time precision to ['N] bits.]]
+]
+
+[h5 Custom Specializing a constant]
+
+In addition, for user-defined types that need special handling, it's possible to \[partially-\] specialize
+the internal structure used by each constant. For example, suppose we're using the C++ wrapper around MPFR
+`mpfr_class`: this has its own representation of Pi which we may well wish to use in place of the above
+mechanism. We can achieve this by specialising the class template `boost::math::constants::detail::constant_pi`:
-The header `boost/math/constants/constants.hpp` contains some numeric constants
-that we have found useful in the development of this library. New constants are
-added on an ad-hoc basis based on need.
-
-Usage is like this:
-
- template <class T>
- T circumference(T r)
+ namespace boost{ namespace math{ namespace constants{ namespace detail{
+
+ template<>
+ struct constant_pi<mpfr_class>
{
- return 2 * boost::math::constants::pi<T>() * r;
+ template<int N>
+ inline T get(const mpl::int_<N>&)
+ {
+ // The template param N is one of the values in the table above,
+ // we can either handle all cases in one as is the case here,
+ // or overload "get" for the different options.
+ mpfr_class result;
+ mpfr_const_pi(result.get_mpfr_t(), GMP_RNDN);
+ return result;
+ }
+ };
+
+ }}}} // namespaces
+
+[h5 Diagnosing what meta-programmed code is doing]
+
+Finally, since it can be tricky to diagnose what meta-programmed code is doing, there is a
+diagnostic routine that prints information about how this library will handle a specific type,
+it can be used like this:
+
+ #include <boost/math/constants/info.hpp>
+
+ int main()
+ {
+ boost::math::constants::print_info_on_type<MyType>();
}
-All the constants are accurate to at least the 34 decimal digits required for 128-bit
-long doubles, and most are accurate to 100 digits or more when used with
-a suitable arbitrary precision type.
+If you wish, you can also pass an optional std::ostream argument to the `print_info_on_type` function.
+Typical output for a user-defined type looks like this:
-The following table summarises the constants we have at present:
+[pre
+Information on the Implementation and Handling of
+Mathematical Constants for Type class boost::math::concepts::real_concept
+
+Checking for std::numeric_limits<class boost::math::concepts::real_concept> specialisation: no
+boost::math::policies::precision<class boost::math::concepts::real_concept, Policy>
+reports that there is no compile type precision available.
+boost::math::tools::digits<class boost::math::concepts::real_concept>()
+reports that the current runtime precision is
+53 binary digits.
+No compile time precision is available, the construction method
+will be decided at runtime and results will not be cached
+- this may lead to poor runtime performance.
+Current runtime precision indicates that
+the constant will be constructed from a string on each call.
+]
-[table
-[[Constant][Meaning][Value]]
-[[pi][[pi]][3.1415926535897932384...]]
-[[root_pi][[radic][pi]][1.772453850905516027...]]
-[[root_half_pi][[radic]([pi]/2)][1.253314137315500251...]]
-[[root_two_pi][[radic](2*[pi])][2.506628274631000502...]]
-[[root_ln_four][[radic](ln(4))][1.17741002251547469...]]
-[[e][['e]][2.71828182845904523536...]]
-[[half][0.5][0.5]]
-[[euler][Euler's constant][0.577215664901532860606]]
-[[root_two][[radic]2][1.4142135623730950488...]]
-[[ln_two][ln(2)][0.6931471805599453094...]]
-[[ln_ln_two][ln(ln(2))][-0.3665129205816643...]]
-[[third][1/3][0.333333333333333333...]]
-[[twothirds][2/3][0.666666666666666666...]]
-[[pi_minus_three][[pi]-3][0.14159265358979323846...]]
-[[four_minus_pi][4-[pi]][0.85840734641020676153735...]]
-]
-
-[endsect][/section Numeric Constants]
-
-[/
- Copyright 2008 John Maddock and Paul A. Bristow.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
+[endsect] [/section:user_def Use With User Defined Types]
+
+[endsect] [/section:tutorial Tutorial]
+
+[section:constants The Mathematical Constants]
+
+This section lists the mathematical constants, their use(s) (and sometimes rationale for their inclusion).
+[table Mathematical Constants
+[[name] [formula] [Value (6 decimals)] [Uses and Rationale]]
+[[[*Rational fractions]] [] [] [] ]
+[[half] [1/2] [0.5] [] ]
+[[third] [1/3] [0.333333] [] ]
+[[two_thirds] [2/3] [0.66667] [] ]
+[[three_quarters] [3/4] [0.75] [] ]
+
+[[[*two and related]] [] [] [] ]
+[[root_two] [[radic]2] [1.41421] [] ]
+[[root_three] [[radic]3] [1.73205] [] ]
+[[half_root_two] [[radic]2 /2] [0.707106] [] ]
+[[ln_two] [ln(2)] [0.693147] [] ]
+[[ln_ten] [ln(10)] [2.30258] [] ]
+[[ln_ln_two] [ln(ln(2))] [-0.366512] [Gumbel distribution median] ]
+[[root_ln_four] [[radic]ln(4)] [1.177410] [] ]
+[[one_div_root_two] [1/[radic]2] [0.707106] [] ]
+
+[[[*[pi] and related]] [] [] [] ]
+[[pi] [pi] [3.14159] [Ubiquitous. Archimedes constant [@http://en.wikipedia.org/wiki/Pi [pi]]]]
+[[half_pi] [[pi]/2] [1.570796] [] ]
+[[third_pi] [[pi]/3] [1.04719] [] ]
+[[sixth_pi] [[pi]/6] [0.523598] [] ]
+[[two_pi] [2[pi]] [6.28318] [Many uses, most simply, circumference of a circle]]
+[[two_thirds_pi] [2/3 [pi]] [2.09439] [[@http://en.wikipedia.org/wiki/Sphere#Volume_of_a_sphere volume of a hemi-sphere] = 4/3 [pi] r[cubed]]]
+[[three_quarters_pi] [3/4 [pi]] [2.35619] [[@http://en.wikipedia.org/wiki/Sphere#Volume_of_a_sphere volume of a hemi-sphere] = 4/3 [pi] r[cubed]]]
+[[four_thirds_pi] [4/3 [pi]] [4.18879] [[@http://en.wikipedia.org/wiki/Sphere#Volume_of_a_sphere volume of a sphere] = 4/3 [pi] r[cubed]]]
+[[one_div_two_pi] [1/(2[pi])] [1.59155] [Widely used]]
+[[root_pi] [[radic][pi]][1.77245] [Widely used]]
+[[root_half_pi] [[radic] [pi]/2] [1.25331] [Widely used]]
+[[root_two_pi][[radic] [pi]*2] [2.50662] [Widely used]]
+[[one_div_root_pi] [1/[radic][pi]] [0.564189] [] ]
+[[one_div_root_two_pi] [1/[radic](2[pi])] [0.398942] [] ]
+[[root_one_div_pi] [[radic](1/[pi]] [0.564189] [] ]
+[[pi_minus_three] [[pi]-3] [1.41593] [] ]
+[[four_minus_pi] [4 -[pi]] [0.858407] [] ]
+[[pow23_four_minus_pi] [4[super 2/3] - [pi]] [0.795316] [] ]
+[[pi_pow_e] [[pi][super e]] [22.4591] [] ]
+
+[[pi_sqr] [[pi][super 2]] [9.86960] [] ]
+[[pi_sqr_div_six] [[pi][super 2]/6] [1.64493] [] ]
+[[pi_cubed] [[pi][super 3]] [31.00627] [] ]
+[[cbrt_pi] [[radic][super 3] [pi]] [1.46459] [] ]
+[[one_div_cbrt_pi] [1/[radic][super 3] [pi]] [0.682784] [] ]
+
+[[[*Euler's e and related]] [] [] [] ]
+[[e] [e] [2.71828] [[@http://en.wikipedia.org/wiki/E_(mathematical_constant) Euler's constant e]] ]
+[[exp_minus_half] [e [super -1/2]] [0.606530] [] ]
+[[e_pow_pi] [e [super [pi]]] [23.14069] [] ]
+[[root_e] [[radic] e] [1.64872] [] ]
+[[log10_e] [log10(e)] [0.434294] [] ]
+[[one_div_log10_e] [1/log10(e)] [2.30258] [] ]
+
+[[[*Trigonometric]] [] [] [] ]
+[[degree] [radians = [pi] / 180] [0.017453] [] ]
+[[radian] [degrees = 180 / [pi]] [57.2957] [] ]
+[[sin_one] [sin(1)] [0.841470] [] ]
+[[cos_one] [cos(1)] [0.54030] [] ]
+[[sinh_one] [sinh(1)] [1.17520] [] ]
+[[cosh_one] [cosh(1)] [1.54308] [] ]
+
+[[[*Phi]] [ Phidias golden ratio] [[@http://en.wikipedia.org/wiki/Golden_ratio Phidias golden ratio]] [] ]
+[[phi] [(1 + [radic]5) /2] [1.61803] [finance] ]
+[[ln_phi] [ln([phi])] [0.48121] [] ]
+[[one_div_ln_phi] [1/ln([phi])] [2.07808] [] ]
+
+[[[*Euler's Gamma]] [] [] [] ]
+[[euler] [euler] [0.577215] [[@http://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant Euler-Mascheroni gamma constant]] ]
+[[one_div_euler] [1/euler] [1.73245] [] ]
+[[euler_sqr] [euler[super 2]] [0.333177] [] ]
+
+[[[*Misc]] [] [] [] ]
+[[zeta_two] [[zeta](2)] [1.64493] [[@http://en.wikipedia.org/wiki/Riemann_zeta_function Riemann zeta function]] ]
+[[zeta_three] [[zeta](3)] [1.20205] [[@http://en.wikipedia.org/wiki/Riemann_zeta_function Riemann zeta function]] ]
+[[catalan] [['K]] [0.915965] [[@http://mathworld.wolfram.com/CatalansConstant.html Catalan (or Glaisher) combinatorial constant] ]]
+[[glaisher] [['A]] [1.28242] [[@https://oeis.org/A074962/constant Decimal expansion of Glaisher-Kinkelin constant] ]]
+[[khinchin] [['k]] [2.685452] [[@https://oeis.org/A002210/constant Decimal expansion of Khinchin constant] ]]
+
+[[extreme_value_skewness] [12[radic]6 [zeta](3)/ [pi][super 3]] [1.139547] [Extreme value distribution] ]
+[[rayleigh_skewness] [2[radic][pi]([pi]-3)/(4 - [pi])[super 3/2]] [0.631110] [Rayleigh distribution skewness] ]
+[[rayleigh_kurtosis_excess] [-(6[pi][super 2]-24[pi]+16)/(4-[pi])[super 2]] [0.245089] [[@http://en.wikipedia.org/wiki/Rayleigh_distribution Rayleigh distribution kurtosis excess]] ]
+[[rayleigh_kurtosis] [3+(6[pi][super 2]-24[pi]+16)/(4-[pi])[super 2]] [3.245089] [Rayleigh distribution kurtosis] ]
+
+] [/table]
+
+
+[note Integer values are *not included* in this list of math constants, however interesting,
+because they can be so easily and exactly constructed, even for UDT, for example: `static_cast<cpp_float>(42)`.]
+
+[tip If you know the approximate value of the constant, you can search for the value to find Boost.Math chosen name in this table.]
+
+[endsect] [/section:constants The constants]
+
+[section:new_const Defining New Constants]
+
+The library provides some helper code to assist in defining new constants;
+the process for defining a constant called `my_constant` goes like this:
+
+1. [*Define a function that calculates the value of the constant].
+This should be a template function, and be placed in `boost/math/constants/calculate_constants.hpp`
+if the constant is to be added to this library,
+or else defined at the top of your source file if not.
+
+The function should look like this:
+
+ namespace boost{ namespace math{ namespace constants{ namespace detail{
+
+ template <class Real>
+ template <int N>
+ Real constant_my_constant<Real>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
+ {
+ int required_precision = N ? N : tools::digits<Real>();
+ Real result = /* value computed to required_precision bits */ ;
+ return result;
+ }
+
+ }}}} // namespaces
+
+Then define a placeholder for the constant itself:
+
+ namespace boost{ namespace math{ namespace constants{
+
+ BOOST_DEFINE_MATH_CONSTANT(my_constant, 0.0, "0");
+
+ }}}
+
+
+For example, to calculate [pi]/2, add to `boost/math/constants/calculate_constants.hpp`
+
+ template <class T>
+ template<int N>
+ inline T constant_half_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
+ {
+ BOOST_MATH_STD_USING
+ return pi<T, policies::policy<policies::digits2<N> > >() / static_cast<T>(2);
+ }
+
+Then to `boost/math/constants/constants.hpp` add:
+
+ BOOST_DEFINE_MATH_CONSTANT(half_pi, 0.0, "0"); // Actual values are temporary, we'll replace them later.
+
+[note Previously defined constants like pi and e can be used, but by *not simply calling* `pi<T>()`;
+specifying the precision via the policy
+`pi<T, policies::policy<policies::digits2<N> > >()`
+is essential to ensure full accuracy.]
+
+[warning Newly defined constants can only be used once they are included in
+`boost/math/constants/constants.hpp`. So if you add
+`template <class T, class N> T constant_my_constant{...}`,
+then you cannot define `constant_my_constant`
+until you add the temporary `BOOST_DEFINE_MATH_CONSTANT(my_constant, 0.0, "0")`.
+Failing to do this will result in surprising compile errors:
+``
+ error C2143: syntax error : missing ';' before '<'
+ error C2433: 'constant_root_two_div_pi' : 'inline' not permitted on data declarations
+ error C2888: 'T constant_root_two_div_pi' : symbol cannot be defined within namespace 'detail'
+ error C2988: unrecognizable template declaration/definition
+``
]
+
+2. [*You will need an arbitrary precision type to use to calculate the value]. This library
+currently supports either `cpp_float`, `NTL::RR` or `mpfr_class` used via the bindings in `boost/math/bindings`.
+The default is to use `NTL::RR` unless you define an alternate macro, for example,
+`USE_MPFR` or `USE_CPP_FLOAT` at the start of your program.
+
+3. It is necessary to link to the Boost.Regex library,
+and probably to your chosen arbitrary precision type library.
+
+4. The complete program to generate the constant `half_pi` using function `calculate_half_pi` is then:
+
+ #define USE_CPP_FLOAT // If required.
+ #include <boost/math/constants/generate.hpp>
+
+ int main()
+ {
+ BOOST_CONSTANTS_GENERATE(half_pi);
+ }
+
+The output from the program is a snippet of C++ code
+(actually a macro call) that can be cut and pasted
+into `boost/math/constants/constants.hpp` or else into your own code, for example:
+
+[pre
+ BOOST_DEFINE_MATH_CONSTANT(half_pi, 1.570796326794896619231321691639751442e+00, "1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404326e+00");
+]
+
+This macro BOOST_DEFINE_MATH_CONSTANT inserts a C++ struct code snippet that
+declares the `float`, `double` and `long double` versions of the constant,
+plus a decimal digit string representation correct to 100 decimal
+digits, and all the meta-programming machinery needed to select between them.
+
+The result of an expanded macro for Pi is shown below.
+
+[import ./pp_pi.hpp]
+
+[preprocessed_pi]
+
+
+[endsect] [/section:new_const Defining New Constants]
+
+[section:FAQ FAQs]
+
+[h4 Why are ['these] Constants Chosen?]
+It is, of course, impossible to please everyone with a list like this.
+
+Some of the criteria we have used are:
+
+* Used in Boost.Math.
+* Commonly used.
+* Expensive to compute.
+* Requested by users.
+* [@http://en.wikipedia.org/wiki/Mathematical_constant Used in science and mathematics.]
+* No integer values (because so cheap to construct).[br]
+(You can easily define your own if found convenient, for example: `FPT one =static_cast<FPT>(42);`).
+
+[h4 How are constants named?]
+* Not macros, so no upper case.
+* All lower case (following C++ standard names).
+* No CamelCase.
+* Underscore as _ delimiter between words.
+* Numbers spelt as words rather than decimal digits (except following pow).
+* Abbreviation conventions:
+ * root for square root.
+ * cbrt for cube root.
+ * pow for pow function using decimal digits like pow23 for n[super 2/3].
+ * div for divided by or operator /.
+ * minus for operator -, plus for operator +.
+ * sqr for squared.
+ * cubed for cubed n[super 3].
+ * words for greek, like [pi], [zeta] and [Gamma].
+ * words like half, third, three_quarters, sixth for fractions. (Digit(s) can get muddled).
+ * log10 for log[sub 10]
+ * ln for log[sub e]
+
+[h4 How are the constants derived?]
+
+The constants have all been calculated using high-precision software working
+with up to 300-bit precision giving about 100 decimal digits.
+(The precision can be arbitrarily chosen and is limited only by compute time).
+
+[h4 How Accurate are the constants?]
+The minimum accuracy chosen (100 decimal digits) exceeds the
+accuracy of reasonably-foreseeable floating-point hardware (256-bit)
+and should meet most high-precision computations.
+
+[h4 How are the constants tested?]
+
+# Comparison using Boost.Test BOOST_CHECK_CLOSE_FRACTION using long double literals,
+with at least 35 decimal digits, enough to be accurate for all long double implementations.
+The tolerance is usually twice `long double epsilon`.
+
+# Comparison with calculation at long double precision.
+This often requires a slightly higher tolerance than two epsilon
+because of computational noise from round-off etc,
+especially when trig and other functions are called.
+
+# Comparison with independent published values,
+for example, using [@http://oeis.org/ The On-Line Encyclopedia of Integer Sequences (OEIS)]
+again using at least 35 decimal digits strings.
+
+# Comparison with independely calculated values using arbitrary precision tools like
+[@http://www.wolfram.com/mathematica/ Mathematica], again using at least 35 decimal digits literal strings.
+
+[warning We have not yet been able to [*check] that
+[*all] constants are accurate at the full arbitrary precision,
+at present 100 decimal digits.
+But certain key values like `e` and `pi` appear to be accurate
+and internal consistencies suggest that others are this accurate too.
+]
+
+[h4 Why is Portability important?]
+
+Code written using math constants is easily portable even when using different
+floating-point types with differing precision.
+
+It is a mistake to expect that results of computations will be [*identical], but
+you can achieve the [*best accuracy possible for the floating-point type in use].
+
+This has no extra cost to the user, but reduces irritating,
+and often confusing and very hard-to-trace effects,
+caused by the intrinsically limited precision of floating-point calculations.
+
+A harmless symptom of this limit is a spurious least-significant digit;
+at worst, slightly inaccurate constants sometimes cause iterating algorithms
+to diverge wildly because internal comparisons just fail.
+
+[h4 What is the Internal Format of the constants, and why?]
+
+See [link math_toolkit.constants.tutorial tutorial] above for normal use,
+but this FAQ explains the internal details used for the constants.
+
+Constants are stored as 100 decimal digit values.
+However, some compilers do not accept decimal digits strings as long as this.
+So the constant is split into two parts, with the first containing at least
+128-bit long double precision (35 decimal digits),
+and for consistency should be in scientific format with a signed exponent.
+
+The second part is the value of the constant expressed as a string literal,
+accurate to at least 100 decimal digits (in practice that means at least 102 digits).
+Again for consistency use scientific format with a signed exponent.
+
+For types with precision greater than a long double,
+then if T is constructible `T `is constructible from a `const char*`
+then it's directly constructed from the string,
+otherwise we fall back on lexical_cast to convert to type `T`.
+(Using a string is necessary because you can't use a numeric constant
+since even a `long double` might not have enough digits).
+
+So, for example, a constant like pi is internally defined as
+
+ BOOST_DEFINE_MATH_CONSTANT(pi, 3.141592653589793238462643383279502884e+00, "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+00");
+
+In this case the significand is 109 decimal digits, ensuring 100 decimal digits are exact, and exponent is zero.
+
+See [link math_toolkit.constants.new_const defining new constants] to calculate new constants.
+
+A macro definition like this can be pasted into user code where convenient,
+or into `boost/math/constants.hpp` if it is to be added to the Boost.Math library.
+
+[h4 What Floating-point Types could I use?]
+
+Apart from the built-in floating-point types `float`, `double`, `long double`,
+there are several arbitrary precision floating-point classes available,
+but most are not licensed for commercial use.
+
+[h5 Boost.Multiprecision by Christopher Kormanyos]
+
+This work is based on an earlier work called e-float:
+Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations,
+in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011.
+[@http://doi.acm.org/10.1145/1916461.1916469]
+[@https://svn.boost.org/svn/boost/sandbox/e_float/ e_float]
+but is now re-factored and available under the Boost license in the Boost-sandbox at
+[@https://svn.boost.org/svn/boost/sandbox/multiprecision/ multiprecision]
+where it is being refined and prepared for review.
+
+[h5 Boost.cpp_float by John Maddock using Expression Templates]
+
+[@https://svn.boost.org/svn/boost/sandbox/big_number/ Big Number]
+which is a reworking of [@https://svn.boost.org/svn/boost/sandbox/e_float/ e_float]
+by Christopher Kormanyos to use expression templates for faster execution.
+
+[h5 NTL class quad_float]
+
+[@http://shoup.net/ntl/ NTL] by Victor Shoup has fixed and arbitrary high precision fixed and floating-point types.
+However none of these are licenced for commercial use.
+
+ #include <NTL/quad_float.h> // quad precision 106-bit, about 32 decimal digits.
+ using NTL::to_quad_float; // Less precise than arbitrary precision NTL::RR.
+
+NTL class `quad_float`, which gives a form of quadruple precision,
+106-bit significand (but without an extended exponent range.)
+With an IEC559/IEEE 754 compatible processor,
+for example Intel X86 family, with 64-bit double, and 53-bit significand,
+using the significands of [*two] 64-bit doubles,
+if `std::numeric_limits<double>::digits10` is 16,
+then we get about twice the precision,
+so `std::numeric_limits<quad_float>::digits10()` should be 32.
+(the default `std::numeric_limits<RR>::digits10()` should be about 40).
+(which seems to agree with experiments).
+We output constants (including some noisy bits,
+an approximation to `std::numeric_limits<RR>::max_digits10()`)
+by adding 2 extra decimal digits, so using `quad_float::SetOutputPrecision(32 + 2);`
+
+Apple Mac/Darwin uses a similar ['doubledouble] 106-bit for its built-in `long double` type.
+
+[note The precision of all `doubledouble` floating-point types is rather odd and values given are only approximate.]
+
+[h5 NTL class RR]
+
+Arbitrary precision floating point with NTL class RR,
+default is 150 bit (about 50 decimal digits)
+used here with 300 bit to output 100 decimal digits,
+enough for many practical non-'number-theoretic' C++ applications.
+
+NTL is [*not licenced for commercial use].
+
+This class is used in Boost.Math and an option when using big_number projects to calculate new math constants.
+
+[h5 GMP and MPFR]
+
+[@gmplib.org GMP] and [@http://www.mpfr.org/ MPFR] have also been used to compute constants,
+but are licensed under the [@http://www.gnu.org/copyleft/lesser.html Lesser GPL license]
+and are [*not licensed for commercial use].
+
+[h4 What happened to a previous collection of constants proposed for Boost?]
+
+A review concluded that the way in which the constants were presented did not meet many peoples needs.
+None of the methods proposed met many users' essential requirement to allow writing simply `pi` rather than `pi()`.
+Many science and engineering equations look difficult to read when because function call brackets can be confused
+with the many other brackets often needed. All the methods then proposed of avoiding the brackets failed to meet all needs,
+often on grounds of complexity and lack of applicability to various realistic scenarios.
+
+So the simple namespace method, proposed on its own, but rejected at the first review,
+has been added to allow users to have convenient access to float, double and long double values,
+but combined with template struct and functions to allow simultaneous use
+with other non-built-in floating-point types.
+
+[h4 Why do the constants (internally) have a struct rather than a simple function?]
+
+A function mechanism was provided by in previous versions of Boost.Math.
+
+The new mechanism is to permit partial specialization. See Custom Specializing a constant above.
+It should also allow use with other packages like [@http://www.ttmath.org/ ttmath Bignum C++ library.]
+
+[h4 Where can I find other high precision constants?]
+
+# Constants with very high precision and good accuracy (>40 decimal digits)
+from Simon Plouffe's web based collection [@http://pi.lacim.uqam.ca/eng/].
+# [@https://oeis.org/ The On-Line Encyclopedia of Integer Sequences (OEIS)]
+# Checks using printed text optically scanned values and converted from:
+D. E. Knuth, Art of Computer Programming, Appendix A, Table 1, Vol 1, ISBN 0 201 89683 4 (1997)
+# M. Abrahamovitz & I. E. Stegun, National Bureau of Standards, Handbook of Mathematical Functions,
+a reference source for formulae now superceded by
+# Frank W. Olver, Daniel W. Lozier, Ronald F. Boisvert, Charles W. Clark, NIST Handbook of Mathemetical Functions, Cambridge University Press, ISBN 978-0-521-14063-8, 2010.
+# John F Hart, Computer Approximations, Kreiger (1978) ISBN 0 88275 642 7.
+# Some values from Cephes Mathematical Library, Stephen L. Moshier
+and CALC100 100 decimal digit Complex Variable Calculator Program, a DOS utility.
+# Xavier Gourdon, Pascal Sebah, 50 decimal digits constants at [@http://numbers.computation.free.fr/Constants/constants.html Number, constants and computation].
+
+[h4 Where are Physical Constants?]
+
+Not here in this Boost.Math collection, because physical constants:
+
+* Are measurements.
+* Are not truly constant and keeping changing as mensuration technology improves.
+* Have a instrinsic uncertainty.
+* Mathematical constants are stored and represented at varying precision, but should never be inaccurate.
+
+Some physical constants may be available in Boost.Units.
+
+[endsect] [/section:FAQ FAQ]
+
+[endsect]
+
+
+
Modified: branches/release/libs/math/doc/sf_and_dist/credits.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/credits.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/credits.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -64,6 +64,8 @@
from __Mathematica, and of course,
to Eric Weissten for nurturing __Mathworld, an invaluable resource.
+The Skew-normal distribution and Owen's t function were written by Benjamin Sobotta.
+
Plots of the functions and distributions were prepared in
[@http://www.w3.org/ W3C] standard
[@http://www.svg.org/ Scalable Vector Graphic (SVG)] format
Modified: branches/release/libs/math/doc/sf_and_dist/dist_reference.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/dist_reference.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/dist_reference.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -30,6 +30,7 @@
[include distributions/pareto.qbk]
[include distributions/poisson.qbk]
[include distributions/rayleigh.qbk]
+[include distributions/skew_normal.qbk]
[include distributions/students_t.qbk]
[include distributions/triangular.qbk]
[include distributions/uniform.qbk]
Modified: branches/release/libs/math/doc/sf_and_dist/distributions/normal.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/distributions/normal.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/distributions/normal.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -35,13 +35,22 @@
Given mean [mu][space]and standard deviation [sigma][space]it has the PDF:
-[equation normal_ref1]
+[space] [equation normal_ref1]
The variation the PDF with its parameters is illustrated
in the following graph:
[graph normal_pdf]
+The cumulative distribution function is given by
+
+[space] [equation normal_cdf]
+
+and illustrated by this graph
+
+[graph normal_cdf]
+
+
[h4 Member Functions]
normal_distribution(RealType mean = 0, RealType sd = 1);
@@ -94,6 +103,7 @@
[[quantile from the complement][Using the relation: x = m + s * sqrt(2) * __erfc_inv(2*p)]]
[[mean and standard deviation][The same as `dist.mean()` and `dist.standard_deviation()`]]
[[mode][The same as the mean.]]
+[[median][The same as the mean.]]
[[skewness][0]]
[[kurtosis][3]]
[[kurtosis excess][0]]
@@ -102,7 +112,7 @@
[endsect][/section:normal_dist Normal]
[/ normal.qbk
- Copyright 2006, 2007 John Maddock and Paul A. Bristow.
+ Copyright 2006, 2007, 2012 John Maddock and Paul A. Bristow.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
Modified: branches/release/libs/math/doc/sf_and_dist/fp_facets.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/fp_facets.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/fp_facets.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -338,7 +338,7 @@
[h5 signed_zero]
If the `signed_zero` flag is used with `nonfinite_num_put`,
-then the facet will distinguish between positive and negative zero.
+then the facet will always distinguish between positive and negative zero.
It will format positive zero as "0" or "+0" and negative zero as "-0".
The string representation of positive zero can be controlled
with the `showpos` and `noshowpos` manipulators.
@@ -348,6 +348,16 @@
as positive zero and "-0" as negative zero,
as do most implementations of `std::num_get`.
+[note If the `signed_zero` flag is not set (the default), then a negative zero value
+will be displayed on output in whatever way the platform normally handles it.
+For most platforms, this it will format positive zero as "0" or "+0" and negative zero as "-0".
+But setting the `signed_zero` flag may be more portable.]
+
+[tip A negative zero value can be portably produced using the changesign function
+`(changesign)(static_cast<ValType>(0))` where `ValType` is `float`, `double` or `long double`,
+ or a User-Defined floating-point type (UDT) provided that this UDT has a sign
+and that the changesign function is implemented.]
+
[h5 trap_infinity]
If the `trap_infinity` flag is used with `nonfinite_num_put`,
@@ -361,6 +371,7 @@
then the facet will set the `fail bit` of the stream when an attempt is made
to parse a string that represents positive or negative infinity.
+
(See Design Rationale below for a discussion of this inconsistency.)
[h5 trap_nan]
@@ -502,6 +513,9 @@
Example [@../../../example/nonfinite_num_facet.cpp] shows output and re-input
of various finite and nonfinite values.
+A simple example of trapping nonfinite output is at
+[@../../../example/nonfinite_num_facet_trap.cpp nonfinite_num_facet_trap.cpp].
+
A very basic example of using Boost.Archive is at
[@../../../example/nonfinite_serialization_archives.cpp].
Modified: branches/release/libs/math/doc/sf_and_dist/graphs/dist_graphs.cpp
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/graphs/dist_graphs.cpp (original)
+++ branches/release/libs/math/doc/sf_and_dist/graphs/dist_graphs.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -10,7 +10,7 @@
\author John Maddock and Paul A. Bristow
*/
// Copyright John Maddock 2008.
-// Copyright Paul A. Bristow 2008, 2009
+// Copyright Paul A. Bristow 2008, 2009, 2012
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -499,6 +499,26 @@
rayleigh_cdf_plotter.add(boost::math::rayleigh_distribution<>(10), "σ=10");
rayleigh_cdf_plotter.plot("Rayleigh Distribution CDF", "rayleigh_cdf.svg");
+ distribution_plotter<boost::math::skew_normal_distribution<> >
+ skew_normal_plotter;
+ skew_normal_plotter.add(boost::math::skew_normal_distribution<>(0,1,0), "{0,1,0}");
+ skew_normal_plotter.add(boost::math::skew_normal_distribution<>(0,1,1), "{0,1,1}");
+ skew_normal_plotter.add(boost::math::skew_normal_distribution<>(0,1,4), "{0,1,4}");
+ skew_normal_plotter.add(boost::math::skew_normal_distribution<>(0,1,20), "{0,1,20}");
+ skew_normal_plotter.add(boost::math::skew_normal_distribution<>(0,1,-2), "{0,1,-2}");
+ skew_normal_plotter.add(boost::math::skew_normal_distribution<>(-2,0.5,-1), "{-2,0.5,-1}");
+ skew_normal_plotter.plot("Skew Normal Distribution PDF", "skew_normal_pdf.svg");
+
+ distribution_plotter<boost::math::skew_normal_distribution<> >
+ skew_normal_cdf_plotter(false);
+ skew_normal_cdf_plotter.add(boost::math::skew_normal_distribution<>(0,1,0), "{0,1,0}");
+ skew_normal_cdf_plotter.add(boost::math::skew_normal_distribution<>(0,1,1), "{0,1,1}");
+ skew_normal_cdf_plotter.add(boost::math::skew_normal_distribution<>(0,1,4), "{0,1,4}");
+ skew_normal_cdf_plotter.add(boost::math::skew_normal_distribution<>(0,1,20), "{0,1,20}");
+ skew_normal_cdf_plotter.add(boost::math::skew_normal_distribution<>(0,1,-2), "{0,1,-2}");
+ skew_normal_cdf_plotter.add(boost::math::skew_normal_distribution<>(-2,0.5,-1), "{-2,0.5,-1}");
+ skew_normal_cdf_plotter.plot("Skew Normal Distribution CDF", "skew_normal_cdf.svg");
+
distribution_plotter<boost::math::triangular_distribution<> >
triangular_plotter;
triangular_plotter.add(boost::math::triangular_distribution<>(-1,0,1), "{-1,0,1}");
@@ -622,4 +642,4 @@
hypergeometric_plotter2.add(boost::math::hypergeometric_distribution<>(450, 50, 500), "N=500, r=50, n=450");
hypergeometric_plotter2.plot("Hypergeometric Distribution PDF", "hypergeometric_pdf_2.svg");
-}
+} // int main()
Modified: branches/release/libs/math/doc/sf_and_dist/html4_symbols.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/html4_symbols.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/html4_symbols.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -4,16 +4,16 @@
[/ See also http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references]
[/ http://www.alanwood.net/demos/ent4_frame.html]
[/ http://www.unicode.org/charts/PDF/U2200.pdf and others]
-[/ All (except 2 angle brackets) show OK on Firefox 2.0]
+[/ All (except 2 angle brackets) show OK on Firefox 2.0 and higher]
[/ See also Latin-1 aka Western (ISO-8859-1) in latin1_symbols.qbk]
[/ http://www.htmlhelp.com/reference/html40/entities/latin1.html]
[/Unicode Latin extended http://www.unicode.org/charts/U0080.pdf]
-[/ Also some miscellaneous math charaters added to this list - see the end.]
+[/ Also some miscellaneous math characters added to this list - see the end.]
[/ For others see also math_symbols.qbk]
-[/ To use, enclose the template name in square brackets.]
+[/ To use, enclose the template name in square brackets, for example: [pi]]
[template fnof[]'''ƒ'''] [/ Latin small f with hook = function = florin]
[/ Capital Greek start with capital letter, lower case all small.]
@@ -186,9 +186,11 @@
[template plusminus[]'''±'''] [/ ? plus or minus sign]
[template sqrt[]'''√'''] [/ ? square root sqrt symbol]
-[/template pow2[]'''⁳'''] [/ 2073 is NOT superscript 2 character]
+[/template pow2[]'''⁳'''] [/ 2073 is NOT superscript 2 and 3 characters]
[template pow2[]'''²'''] [/ superscript 2 character]
[template pow3[]'''³'''] [/ superscript 3 character]
+[/ Unicode 2070 to 209F has super and subscript digits and characters, unicode.org/charts/PDF/U2070.pdf]
+[template pow4[]'''⁴'''] [/ superscript 4 character]
[template pown[]'''ⁿ'''] [/ superscript n character]
[template frac12[]'''½'''] [/ fraction half]
[template frac14[]'''¼'''] [/ fraction quarter]
@@ -207,7 +209,7 @@
[template raquo[]'''»'''] [/ right-pointing double angle quotation mark = right pointing guillemet ]
[/
-Copyright 2007, 2010 Paul A. Bristow.
+Copyright 2007, 2010, 2012 Paul A. Bristow.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
Modified: branches/release/libs/math/doc/sf_and_dist/implementation.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/implementation.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/implementation.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -453,19 +453,22 @@
]
Note that unlike the sample config file supplied with SVGMath, this does not
-make use of the Mathematica 7 font as this lacks sufficient Unicode information
+make use of the [@http://support.wolfram.com/technotes/fonts/windows/latestfonts.html Mathematica 7 font]
+as this lacks sufficient Unicode information
for it to be used with either SVGMath or XEP "as is".
Also note that the SVG files in the repository are almost certainly
Windows-specific since they reference various Windows Fonts.
-PNG files can be created from the SVG's using
+PNG files can be created from the SVGs using
[@http://xmlgraphics.apache.org/batik/tools/rasterizer.html Batik]
and a command such as:
[pre java -jar 'C:\download\open\batik-1.7\batik-rasterizer.jar' -dpi 120 *.svg]
-Or using Inkscape and a command such as:
+Or using Inkscape (File, Export bitmap, Drawing tab, bitmap size (default size, 100 dpi), Filename (default). png)
+
+or Using Cygwin, a command such as:
[pre for file in *.svg; do
/cygdrive/c/progra~1/Inkscape/inkscape -d 120 -e $(cygpath -a -w $(basename $file .svg).png) $(cygpath -a -w $file);
Modified: branches/release/libs/math/doc/sf_and_dist/index.idx
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/index.idx (original)
+++ branches/release/libs/math/doc/sf_and_dist/index.idx 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,6 +1,15 @@
+# Boost.Math Indexing terms file.
+# Copyright John Maddock 2009 - 2012
+# Copyright Paul A. Bristow 2009 - 2012
"Lanczos approximation" lanczos
+closed form \<closed\w*\>
+
+expression \<express\w*\>
+
+constants \<constant\w*\>
+
!scan-path boost/math .*\.hpp true
!exclude policy precision apply evaluation polynomial name helper
Modified: branches/release/libs/math/doc/sf_and_dist/issues.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/issues.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/issues.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -67,12 +67,14 @@
to be an real problem in practice - especially as most other implementations
don't support this domain either (Medium Priority).
-[h4 Bessel Functions]
+[h4 Owen's T Function]
-We should implement the Hankel H1 and H2 functions as linear combinations of Bessel functions.
-Requires refactoring the internals so we can reliably calculate pairs of Bessel functions at the same time.
-We may also be able to improve performance of the Bessel series evaluation by accelerating the alternating
-series. This may also increase the scope of the series form.
+There is a problem area at arbitrary precision when ['a] is very close to 1. However, note that
+the value for ['T(h, 1)] is well known and easy to compute, and if we replaced the
+['a[super k]] terms in series T1, T2 or T4 by ['(a[super k] - 1)] then we would have the
+difference between ['T(h, a)] and ['T(h, 1)]. Unfortunately this doesn't improve the
+convergence of those series in that area. It certainly looks as though a new series in terms
+of ['(1-a)[super k]] is both possible and desirable in this area, but it remains elusive at present.
[h4 Jocobi elliptic functions]
Modified: branches/release/libs/math/doc/sf_and_dist/math.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/math.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/math.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,13 +1,13 @@
[article Math Toolkit
[quickbook 1.5]
- [copyright 2006, 2007, 2008, 2009, 2010 John Maddock, Paul A. Bristow, Hubert Holin, Xiaogang Zhang, Bruno Lalande, Johan RÃ¥de, Gautam Sewani and Thijs van den Berg]
+ [copyright 2006, 2007, 2008, 2009, 2010 John Maddock, Paul A. Bristow, Hubert Holin, Xiaogang Zhang, Bruno Lalande, Johan RÃ¥de, Gautam Sewani, Thijs van den Berg and Benjamin Sobotta]
[/purpose ISBN 0-9504833-2-X 978-0-9504833-2-0, Classification 519.2-dc22]
[license
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
[@http://www.boost.org/LICENSE_1_0.txt])
]
- [authors [Maddock, John], [Bristow, Paul A.], [Holin, Hubert], [Zhang, Xiaogang], [Lalande, Bruno], [RÃ¥de, Johan], [Sewani, Gautam], [van den Berg, Thijs]]
+ [authors [Maddock, John], [Bristow, Paul A.], [Holin, Hubert], [Zhang, Xiaogang], [Lalande, Bruno], [RÃ¥de, Johan], [Sewani, Gautam], [van den Berg, Thijs], [Sobotta, Benjamin]]
[/last-revision $Date$]
]
@@ -31,6 +31,9 @@
</imageobject>
</inlinemediaobject>''']
+[include ../../../../tools/auto_index/include/auto_index_helpers.qbk]
+[/ Must be first included file!]
+
[include html4_symbols.qbk]
[/include math_symbols.qbk]
@@ -148,6 +151,12 @@
[def __sph_bessel [link math_toolkit.special.bessel.sph_bessel sph_bessel]]
[def __sph_neumann [link math_toolkit.special.bessel.sph_bessel sph_neumann]]
+[/Hankel Functions]
+[def __cyl_hankel_1 [link math_toolkit.special.hankel.cyl_hankel cyl_hankel_1]]
+[def __cyl_hankel_2 [link math_toolkit.special.hankel.cyl_hankel cyl_hankel_2]]
+[def __sph_hankel_1 [link math_toolkit.special.hankel.sph_hankel sph_hankel_1]]
+[def __sph_hankel_2 [link math_toolkit.special.hankel.sph_hankel sph_hankel_2]]
+
[/sinus cardinals]
[def __sinc_pi [link math_toolkit.special.sinc.sinc_pi sinc_pi]]
[def __sinhc_pi [link math_toolkit.special.sinc.sinhc_pi sinhc_pi]]
@@ -196,6 +205,8 @@
[/Misc]
[def __expint [link math_toolkit.special.expint.expint_i expint]]
[def __spherical_harmonic [link math_toolkit.special.sf_poly.sph_harm spherical_harmonic]]
+[def __owens_t [link math_toolkit.special.owens_t Owens T]]
+
[/tools]
[def __tuple [link math_toolkit.toolkit.internals1.tuples boost::math::tuple]]
@@ -244,6 +255,7 @@
[def __normal_distrib [link math_toolkit.dist.dist_ref.dists.normal_dist Normal Distribution]]
[def __poisson_distrib [link math_toolkit.dist.dist_ref.dists.poisson_dist Poisson Distribution]]
[def __students_t_distrib [link math_toolkit.dist.dist_ref.dists.students_t_dist Students t Distribution]]
+[def __skew_normal_distrib [link math_toolkit.dist.dist_ref.dists.skew_normal_dist Skew Normal Distribution]]
[def __weibull_distrib [link math_toolkit.dist.dist_ref.dists.weibull_dist Weibull Distribution]]
[/links to policy]
@@ -275,6 +287,8 @@
[def __NTL [@http://www.shoup.net/ntl/ NTL A Library for doing Number Theory]]
[def __NTL_RR [@http://shoup.net/ntl/doc/RR.txt NTL::RR]]
[def __NTL_quad_float [@http://shoup.net/ntl/doc/quad_float.txt NTL::quad_float]]
+[def __MPFR [@http://www.mpfr.org/ MPFR]]
+[def __GMP [@http://gmplib.org/ GNU Multiple Precision Arithmetic Library]]
[def __R [@http://www.r-project.org/ The R Project for Statistical Computing]]
[def __godfrey [link godfrey Godfrey]]
[def __pugh [link pugh Pugh]]
@@ -413,6 +427,9 @@
[include bessel_spherical.qbk]
[endsect] [/section:bessel Bessel Functions]
+[/Hankel functions]
+[include hankel.qbk]
+
[section:ellint Elliptic Integrals]
[include ellint_introduction.qbk]
[include ellint_carlson.qbk]
@@ -429,6 +446,8 @@
[include sinc.qbk]
[include inv_hyper.qbk]
+[include owens_t.qbk]
+
[endsect] [/section:special Special Functions]
[section:utils Floating Point Utilities]
@@ -447,12 +466,13 @@
[include tr1_ref.qbk]
[endsect]
-[section:toolkit Tools, Constants and Internal Details]
+[include constants.qbk]
+
+[section:toolkit Tools and Internal Details]
[include internals_overview.qbk]
-[section:internals1 Utilities - Constants & Tools]
-[include constants.qbk]
+[section:internals1 Utilities & Tools]
[include series.qbk]
[include fraction.qbk]
[include rational.qbk]
@@ -460,7 +480,7 @@
[include roots_without_derivatives.qbk]
[include minima.qbk]
[include tuple.qbk]
-[endsect] [/section:internals1 Utilities - Constants & Tools]
+[endsect] [/section:internals1 Utilities & Tools]
[section:internals2 Testing and Development]
[include polynomial.qbk]
@@ -498,7 +518,6 @@
[endsect] [/section:status Status and Roadmap]
-[include ../../../../tools/auto_index/include/auto_index_helpers.qbk]
[named_index function_name Function Index]
[named_index class_name Class Index]
[named_index typedef_name Typedef Index]
@@ -506,10 +525,11 @@
[index]
[/ math.qbk
- Copyright 2008, 2010 John Maddock and Paul A. Bristow.
+ Copyright 2008, 2010, 2012 John Maddock and Paul A. Bristow.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
]
+
Modified: branches/release/libs/math/doc/sf_and_dist/overview.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/overview.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/overview.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -83,7 +83,7 @@
[endsect] [/section:intro Introduction]
[/
- Copyright 2006 John Maddock and Paul A. Bristow.
+ Copyright 2006, 2012 John Maddock and Paul A. Bristow.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
Modified: branches/release/libs/math/doc/sf_and_dist/roadmap.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/roadmap.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/roadmap.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,5 +1,20 @@
[template history[]
+[h4 Boost-1.50]
+
+* Promoted math constants to be 1st class citizens,
+including convenient access to the most widely used
+built-in float, double, long double via three namespaces.
+* Added the Owen's T function and Skew Normal distribution written by Benjamin Sobotta: see __owens_t and skew_normal_distrib.
+* Added Hankel functions __cyl_hankel_1, __cyl_hankel_2, __sph_hankel_1 and __sph_hankel_2.
+* Corrected issue [@https://svn.boost.org/trac/boost/ticket/6627 #6627 nonfinite_num_put formatting of 0.0 is incorrect]
+based on a patch submitted by K R Walker.
+* Changed constant initialization mechanism so that it is thread safe even for user-defined types, also
+so that user defined types get the full precision of the constant, even when `long double` does not.
+So for example 128-bit rational approximations will work with UDT's and do the right thing, even though
+`long double` may be only 64 or 80 bits.
+* Fixed issue in `bessel_jy` which causes Y[sub 8.5](4[pi]) to yield a NaN.
+
[h4 Boost-1.49]
* Deprecated wrongly named `twothirds` math constant in favour of `two_thirds` (with underscore separator).
Modified: branches/release/libs/math/doc/sf_and_dist/structure.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/structure.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/structure.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,37 +1,93 @@
[section:navigation Navigation]
-Used in combination with the configured browser key, the
-following keys act as handy shortcuts for common navigation tasks.
+[indexterm1 navigation]
-[h5 Shortcuts]
-[:
-[^[*p]] - Previous page
+Boost.Math documentation is provided in both HTML and PDF formats.
-[^[*n]] - Next page
+* [*Tutorials] are listed in the ['Table of Contents] and
+include many examples that should help you get started quickly.
+* [*Source code] of the many ['Examples] will often be your quickest starting point.
+* [*Index] (general) includes all entries.
+* [*Specific Indexes] list only functions, class signatures, macros and typedefs.
-[^[*h]] - home
+[h5 Using the Indexes]
-[^[*u]] - Up
-]
+The main index will usually help,
+especially if you know a word describing what it does,
+without needing to know the exact name chosen for the function.
-The following table shows how to access these from common browsers:
+[tip When using the index, keep in mind that clicking on an index term
+only takes you to the [*section] containing the index entry.
+This section may be several pages long,
+so you may need to use the [*find] facility of your browser or PDF reader
+to get to the index term itself.]
-[table
-[[Browser][Access Method]]
-[[Internet Explorer]
- [Alt+Key highlights the link only, so for example to move to the next topic
- you would need "Alt+n" followed by "Enter".]]
-[[Firefox 2.0 and later][Alt+Shift+Key follows the link, so for example
- "Alt+Shift+n" will take you to the next topic.]]
-[[Opera][Press Shift+Esc followed by the access key.]]
-[[Konqueror][Press and release the Ctrl key, followed by the access key]]
-]
+[tip A PDF reader usually allows a [*global] find; this can be really useful
+if the term you expect to be indexed is not the one chosen by the authors.
+You might find searching the PDF version and viewing the HTML version
+will locate an elusive item.]
+
+[endsect] [/section:navigation Navigation]
+
+[section:conventions Document Conventions]
+
+[indexterm1 conventions]
+
+This documentation aims to use of the following naming and formatting conventions.
+
+* C++ Code is in `fixed width font` and is syntax-highlighted in color, for example `double`.
+* Other code is in block [^teletype fixed-width font].
+* Replaceable text that [*you] will need to supply is in [~italics].
+* If a name refers to a free function, it is specified like this:
+ `free_function()`; that is, it is in [~code font] and its name is followed by `()`
+ to indicate that it is a free function.
+* If a name refers to a class template, it is specified like this:
+ `class_template<>`; that is, it is in code font and its name is followed by `<>`
+ to indicate that it is a class template.
+* If a name refers to a function-like macro, it is specified like this: `MACRO()`;
+ that is, it is uppercase in code font and its name is followed by `()` to
+ indicate that it is a function-like macro. Object-like macros appear without the
+ trailing `()`.
+* Names that refer to ['concepts] in the generic programming sense
+(like template parameter names) are specified in CamelCase.
+
+
+[endsect] [/section:conventions Document Conventions]
+
+[section:hints Other Hints and tips]
+
+* If you have a feature request,
+or if it appears that the implementation is in error,
+please search first in the [@https://svn.boost.org/trac/boost/ Boost Trac].
-Some browsers also make these links available in their site-navigation
-toolbars: in Opera for example you can use Ctrl plus the left and right
-arrow keys to move between "next" and "previous" topics.
+* [@https://svn.boost.org/trac/boost/ Trac] entries may indicate that
+updates or corrections that solve your problem are in
+[@http://svn.boost.org/svn/boost/trunk Boost-trunk]
+where changes are being assembled and tested ready for the next release.
+You may, at your own risk, download new versions from there.
+
+* If you do not understand why things work the way they do, see the ['rationale] section.
+
+* If you do not find your idea/feature/complaint,
+please reach the author preferably through the Boost
+development list, or email the author(s) direct.
+
+[h5 Admonishments]
+
+[note In addition, notes such as this one specify non-essential information that
+provides additional background or rationale.]
+
+[tip These blocks contain information that you may find helpful while coding.]
+
+[important These contain information that is imperative to understanding a concept.
+Failure to follow suggestions in these blocks will probably result in undesired behavior.
+Read all of these you find.]
+
+[warning Failure to heed this will lead to incorrect,
+and very likely undesired, results.]
+
+[endsect] [/section:hints Other Hints and tips]
-[endsect]
[section:directories Directory and File Structure]
@@ -44,7 +100,8 @@
as the RealType (and short `typedef` names of distributions are
reserved for this type where possible), a few will use `float` or
`long double`, but it is also possible to use higher precision types
- like __NTL_RR that conform to the requirements specified by real_concept.]]
+ like __NTL_RR, __GMP, __MPFR
+that conform to the requirements specified by real_concept.]]
[[\/constants\/]
[Templated definition of some highly accurate math
@@ -93,7 +150,7 @@
(and vital) extra features.]]
]
-[endsect]
+[endsect] [/section:directories Directory and File Structure]
[section:namespaces Namespaces]
@@ -109,7 +166,7 @@
student_t mydist(10);
-[note Some distribution names are also used in std random library,
+[warning Some distribution names are also used in std random library,
so to avoid the risk of ambiguity it is better to make explicit using declarations,
for example: `using boost::math::students_t_distribution`]
@@ -121,10 +178,15 @@
__Policy and configuration information is in namespace `boost::math::policies`.
-[endsect]
+[tip Many code snippets assume implicit namespace(s),
+for example, `std::` or `boost::math`.]
+
+
+[endsect] [/section:namespaces Namespaces]
+
[/ structure.qbk
- Copyright 2006, 2010 John Maddock and Paul A. Bristow.
+ Copyright 2006, 2010, 2012 John Maddock and Paul A. Bristow.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
Modified: branches/release/libs/math/doc/sf_and_dist/thread_safety.qbk
==============================================================================
--- branches/release/libs/math/doc/sf_and_dist/thread_safety.qbk (original)
+++ branches/release/libs/math/doc/sf_and_dist/thread_safety.qbk 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,24 +1,9 @@
[section:threads Thread Safety]
-The library is fully thread safe and re-entrant provided the function
-and class templates in the library are instantiated with
-built-in floating point types: i.e. the types `float`, `double`
-and `long double`.
-
-However, the library [*is not thread safe] when
-used with user-defined (i.e. class type) numeric types.
-
-The reason for the latter limitation is the need to
-initialise symbolic constants using constructs such as:
-
- static const T coefficient_array = { ... list of values ... };
-
-Which is always thread safe when T is a built-in floating point type,
-but not when T is a user defined type: as in this case there
-is a need for T's constructors to be run, leading to potential
-race conditions.
-
-This limitation may be addressed in a future release.
+The library is fully thread safe and re-entrant for all functions
+regards of the data type they are instantiated on. Thread safety
+limitations relating to user defined types present in previous
+releases (prior to 1.50.0) have been removed.
[endsect] [/section:threads Thread Safety]
Modified: branches/release/libs/math/example/Jamfile.v2
==============================================================================
--- branches/release/libs/math/example/Jamfile.v2 (original)
+++ branches/release/libs/math/example/Jamfile.v2 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -71,6 +71,7 @@
run nonfinite_facet_sstream.cpp ;
run normal_misc_examples.cpp ;
+run owens_t_example.cpp ;
run policy_eg_1.cpp ;
run policy_eg_10.cpp ;
run policy_eg_2.cpp ;
@@ -94,6 +95,7 @@
run policy_ref_snip7.cpp ;
run policy_ref_snip8.cpp ;
run policy_ref_snip9.cpp ;
+run skew_normal_example.cpp ;
run students_t_example1.cpp ;
run students_t_example2.cpp ;
run students_t_example3.cpp ;
@@ -102,4 +104,3 @@
-
Modified: branches/release/libs/math/example/nonfinite_facet_simple.cpp
==============================================================================
--- branches/release/libs/math/example/nonfinite_facet_simple.cpp (original)
+++ branches/release/libs/math/example/nonfinite_facet_simple.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -218,14 +218,14 @@
// Similarly if we can switch back to the default C locale.
cout.imbue (default_locale);
cout << "infinity in default C representation is " << plus_infinity << endl;
- cout << "infinity in default C representation (setw(" << width << ") is " << setw(width) << plus_infinity <<'|' << endl;
- cout << "infinity in default C representation (setw(" << width << ") is " << left << setw(width) << plus_infinity <<'|' << endl;
- cout << "infinity in default C representation (setw(" << width << ") is " << internal << setw(width) << plus_infinity <<'|' << endl;
+ cout << "infinity in default C representation (setw(" << width << ") is |" << setw(width) << plus_infinity <<'|' << endl;
+ cout << "infinity in default C representation (setw(" << width << ") is |" << left << setw(width) << plus_infinity <<'|' << endl;
+ cout << "infinity in default C representation (setw(" << width << ") is |" << internal << setw(width) << plus_infinity <<'|' << endl;
cout.imbue (C99_out_locale);
- cout << "infinity in C99 representation (setw(" << width << ") is " << right << setw(width) << plus_infinity <<'|'<< endl;
- cout << "infinity in C99 representation (setw(" << width << ") is " << left << setw(width) << plus_infinity <<'|'<< endl;
- cout << "infinity in C99 representation (setw(" << width << ") is " << internal << setw(width) << plus_infinity <<'|'<< endl;
+ cout << "infinity in C99 representation (setw(" << width << ") is |" << right << setw(width) << plus_infinity <<'|'<< endl;
+ cout << "infinity in C99 representation (setw(" << width << ") is |" << left << setw(width) << plus_infinity <<'|'<< endl;
+ cout << "infinity in C99 representation (setw(" << width << ") is |" << internal << setw(width) << plus_infinity <<'|'<< endl;
return 0;
} // int main()
Modified: branches/release/libs/math/test/Jamfile.v2
==============================================================================
--- branches/release/libs/math/test/Jamfile.v2 (original)
+++ branches/release/libs/math/test/Jamfile.v2 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -36,25 +36,35 @@
<toolset>msvc:<cxxflags>/wd4189 # local variable is initialized but not referenced
<toolset>msvc-7.1:<source>../vc71_fix//vc_fix
<toolset>msvc-7.1:<pch>off
- <toolset>borland:<link>static
<toolset>borland:<runtime-link>static
# <toolset>msvc:<cxxflags>/wd4506 has no effect?
# suppress xstring(237) : warning C4506: no definition for inline function
<include>../../..
<source>../../regex/build//boost_regex
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
- # Sunpro and cygwin/Mingw have problems building regex as a shared lib:
- <toolset>sun:<link>static
- <toolset>gcc-mw:<link>static
- <toolset>gcc-mingw:<link>static
- <toolset>gcc-cygwin:<link>static
+ # For simplicities sake, make everything a static lib:
+ <link>static
<define>BOOST_ALL_NO_LIB=1
<define>BOOST_UBLAS_UNSUPPORTED_COMPILER=0
<include>.
<include>$(ntl-path)/include
<include>$(e_float_path)
<include>$(gmp_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx <include>$(gmp_path)/mpfrc++
+ <search>$(gmp_path)
+ <search>$(mpfr_path)
+ <search>$(mpfr_path)/build.vc10/lib/Win32/Debug
;
+
+if $(ntl-path)
+{
+ lib ntl : [ GLOB $(ntl-path)/src : *.cpp ] ;
+}
+else
+{
+ lib ntl ;
+}
+
+explicit ntl ;
cpp-pch pch : pch.hpp : <use>../../test/build//boost_test_exec_monitor ;
cpp-pch pch_light : pch_light.hpp : <use>../../test/build//boost_test_exec_monitor ;
@@ -66,9 +76,11 @@
run pow_test.cpp ../../test/build//boost_test_exec_monitor ;
run log1p_expm1_test.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
run powm1_sqrtp1m1_test.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
-run special_functions_test.cpp ../../test/build//boost_unit_test_framework/<link>static ;
+run special_functions_test.cpp ../../test/build//boost_unit_test_framework ;
run test_bernoulli.cpp ../../test/build//boost_test_exec_monitor ;
-run test_constants.cpp pch ../../test/build//boost_test_exec_monitor ;
+run test_constants.cpp ../../test/build//boost_test_exec_monitor ;
+run test_print_info_on_type.cpp ;
+run test_constant_generate.cpp ntl : : : [ check-target-builds ../config//has_ntl_rr : : <build>no ] : test_constant_generate_ntl ;
run test_bessel_j.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
run test_bessel_y.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
run test_bessel_i.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
@@ -175,6 +187,7 @@
run test_gamma.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
run test_gamma_dist.cpp pch ../../test/build//boost_test_exec_monitor ;
run test_geometric.cpp ../../test/build//boost_test_exec_monitor ;
+run test_hankel.cpp ../../test/build//boost_test_exec_monitor ;
run test_hermite.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
run test_hypergeometric_dist.cpp ../../test/build//boost_test_exec_monitor
: # command line
@@ -432,7 +445,7 @@
run test_inverse_gaussian.cpp ../../test/build//boost_test_exec_monitor ;
-run test_laplace.cpp ../../test/build//boost_unit_test_framework/<link>static ;
+run test_laplace.cpp ../../test/build//boost_unit_test_framework ;
run test_inv_hyp.cpp pch ../../test/build//boost_test_exec_monitor ;
run test_laguerre.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
run test_legendre.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
@@ -563,6 +576,7 @@
<toolset>intel:<pch>off
: test_nc_t_real_concept ;
run test_normal.cpp pch ../../test/build//boost_test_exec_monitor ;
+run test_owens_t.cpp ../../test/build//boost_test_exec_monitor ;
run test_pareto.cpp ../../test/build//boost_test_exec_monitor ;
run test_poisson.cpp ../../test/build//boost_test_exec_monitor
: # command line
@@ -623,6 +637,7 @@
run test_spherical_harmonic.cpp test_instances pch_light ../../test/build//boost_test_exec_monitor ;
run test_students_t.cpp ../../test/build//boost_test_exec_monitor ;
run test_sign.cpp ../../test/build//boost_test_exec_monitor ;
+run test_skew_normal.cpp ../../test/build//boost_test_exec_monitor ;
run test_tgamma_ratio.cpp pch ../../test/build//boost_test_exec_monitor ;
run test_toms748_solve.cpp pch ../../test/build//boost_test_exec_monitor ;
run test_triangular.cpp pch ../../test/build//boost_test_exec_monitor ;
@@ -778,18 +793,18 @@
compile compile_test/tools_toms748_inc_test.cpp ;
run ../test/common_factor_test.cpp
- ../../test/build//boost_unit_test_framework/<link>static ;
+ ../../test/build//boost_unit_test_framework ;
run ../octonion/octonion_test.cpp
- ../../test/build//boost_unit_test_framework/<link>static ;
+ ../../test/build//boost_unit_test_framework ;
run ../quaternion/quaternion_test.cpp
- ../../test/build//boost_unit_test_framework/<link>static ;
+ ../../test/build//boost_unit_test_framework ;
run ../quaternion/quaternion_mult_incl_test.cpp
../quaternion/quaternion_mi1.cpp
../quaternion/quaternion_mi2.cpp
- ../../test/build//boost_unit_test_framework/<link>static ;
+ ../../test/build//boost_unit_test_framework ;
run test_legacy_nonfinite.cpp ../../test/build//boost_test_exec_monitor ;
@@ -811,3 +826,6 @@
+
+
+
Modified: branches/release/libs/math/test/acosh_data.ipp
==============================================================================
--- branches/release/libs/math/test/acosh_data.ipp (original)
+++ branches/release/libs/math/test/acosh_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -5,8 +5,8 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 2>, 261> acosh_data = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 261> acosh_data = {{
{{ SC_(1.000001430511474609375), SC_(0.001691455665129294448190238354291760044433) }},
{{ SC_(1.0000019073486328125), SC_(0.001953124689559275021527821917817027620963) }},
{{ SC_(1.000007152557373046875), SC_(0.003782208044661295168504799813496158490314) }},
Modified: branches/release/libs/math/test/asinh_data.ipp
==============================================================================
--- branches/release/libs/math/test/asinh_data.ipp (original)
+++ branches/release/libs/math/test/asinh_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -5,8 +5,8 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 2>, 281> asinh_data = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 281> asinh_data = {{
{{ SC_(-497.181640625), SC_(-6.902103625349694816896128061929344488774) }},
{{ SC_(-495.216552734375), SC_(-6.898143347143858285101511567975488446084) }},
{{ SC_(-488.0980224609375), SC_(-6.883664481302669222996695409880306523751) }},
Modified: branches/release/libs/math/test/assoc_legendre_p.ipp
==============================================================================
--- branches/release/libs/math/test/assoc_legendre_p.ipp (original)
+++ branches/release/libs/math/test/assoc_legendre_p.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 400> assoc_legendre_p = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 400> assoc_legendre_p = {{
{{ SC_(3.755727291107177734375), SC_(-3), SC_(0.264718532562255859375), SC_(0.018682285998021253444483874168352748715136623066073) }},
{{ SC_(3.755727291107177734375), SC_(-3), SC_(0.67001712322235107421875), SC_(0.0085227010576716344744906184676725516467064196759033) }},
{{ SC_(3.755727291107177734375), SC_(-3), SC_(0.91501367092132568359375), SC_(0.0013678553914178941694232605088191864494205442141689) }},
Modified: branches/release/libs/math/test/atanh_data.ipp
==============================================================================
--- branches/release/libs/math/test/atanh_data.ipp (original)
+++ branches/release/libs/math/test/atanh_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -5,8 +5,8 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 2>, 260> atanh_data = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 260> atanh_data = {{
{{ SC_(-0.9999983310699462890625), SC_(-6.998237084679026894944012639589359039154) }},
{{ SC_(-0.9999978542327880859375), SC_(-6.872579751329170618373487147465365112113) }},
{{ SC_(-0.999992847442626953125), SC_(-6.270592097465752658938563627507298840894) }},
Modified: branches/release/libs/math/test/bessel_i_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_i_data.ipp (original)
+++ branches/release/libs/math/test/bessel_i_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 225> bessel_i_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 225> bessel_i_data = {{
{{ SC_(-0.8049192047119140625e2), SC_(0.24750102996826171875e2), SC_(0.4186983670927603951456761016615805321694e29) }},
{{ SC_(-0.8049192047119140625e2), SC_(0.637722015380859375e2), SC_(0.2032477564839492547710163141114983376107e7) }},
{{ SC_(-0.7460263824462890625e2), SC_(0.24750102996826171875e2), SC_(0.7209773983625557491285409746913864781653e24) }},
Modified: branches/release/libs/math/test/bessel_i_int_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_i_int_data.ipp (original)
+++ branches/release/libs/math/test/bessel_i_int_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 495> bessel_i_int_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 495> bessel_i_int_data = {{
{{ SC_(0), SC_(0.177219114266335964202880859375e-2), SC_(0.1000000785165515654790765567976560128368e1) }},
{{ SC_(0), SC_(0.22177286446094512939453125e-2), SC_(0.1000001229580463247166647265657459686513e1) }},
{{ SC_(0), SC_(0.7444499991834163665771484375e-2), SC_(0.1000013855193023439561602999309818071557e1) }},
Modified: branches/release/libs/math/test/bessel_j_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_j_data.ipp (original)
+++ branches/release/libs/math/test/bessel_j_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 360> bessel_j_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 360> bessel_j_data = {{
{{ SC_(0.4430477856658399105072021484375e-3), SC_(0.553809732082299888134002685546875e-4), SC_(0.9956156809860747445801192500664050062602e0) }},
{{ SC_(0.4430477856658399105072021484375e-3), SC_(0.69304020144045352935791015625e-4), SC_(0.9957146107589140226790508756099801328105e0) }},
{{ SC_(0.4430477856658399105072021484375e-3), SC_(0.23264062474481761455535888671875e-3), SC_(0.9962489699005580621378590557841736186861e0) }},
Modified: branches/release/libs/math/test/bessel_j_int_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_j_int_data.ipp (original)
+++ branches/release/libs/math/test/bessel_j_int_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 224> bessel_j_int_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 224> bessel_j_int_data = {{
{{ SC_(0), SC_(0.1730655412757187150418758392333984375e-5), SC_(0.999999999999251207960573702716351702855e0) }},
{{ SC_(0), SC_(0.216575062950141727924346923828125e-5), SC_(0.9999999999988273810527038974545295287162e0) }},
{{ SC_(0), SC_(0.72700195232755504548549652099609375e-5), SC_(0.9999999999867867040328417323221266089012e0) }},
Modified: branches/release/libs/math/test/bessel_j_large_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_j_large_data.ipp (original)
+++ branches/release/libs/math/test/bessel_j_large_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 70> bessel_j_large_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 70> bessel_j_large_data = {{
{{ SC_(0.725889492034912109375e1), SC_(0.725889492034912109375e1), SC_(0.2307850131230964328215158373258970201933e0) }},
{{ SC_(0.725889492034912109375e1), SC_(0.90838165283203125e1), SC_(0.331270090805281544869225081474258975783e0) }},
{{ SC_(0.725889492034912109375e1), SC_(0.30492671966552734375e2), SC_(0.1392044369140870127137144436194280008198e0) }},
Modified: branches/release/libs/math/test/bessel_k_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_k_data.ipp (original)
+++ branches/release/libs/math/test/bessel_k_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 263> bessel_k_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 263> bessel_k_data = {{
{{ SC_(-0.8049192047119140625e2), SC_(0.24750102996826171875e2), SC_(0.6579017807810652710369517871806355927214e29) }},
{{ SC_(-0.8049192047119140625e2), SC_(0.637722015380859375e2), SC_(0.2395518238062557960566710371847643552469e-8) }},
{{ SC_(-0.8049192047119140625e2), SC_(0.1252804412841796875e3), SC_(0.3069043255911758700865294859650240330974e-44) }},
Modified: branches/release/libs/math/test/bessel_k_int_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_k_int_data.ipp (original)
+++ branches/release/libs/math/test/bessel_k_int_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -2,7 +2,7 @@
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 481> bessel_k_int_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 481> bessel_k_int_data = {{
{{ SC_(0), SC_(0.177219114266335964202880859375e-2), SC_(0.6451475930592273598846015135698055330078e1) }},
{{ SC_(0), SC_(0.22177286446094512939453125e-2), SC_(0.6227212142001190939808570915268231760654e1) }},
{{ SC_(0), SC_(0.7444499991834163665771484375e-2), SC_(0.5016294646816679195434588077252051358532e1) }},
Modified: branches/release/libs/math/test/bessel_y01_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_y01_data.ipp (original)
+++ branches/release/libs/math/test/bessel_y01_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 100> bessel_y01_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 100> bessel_y01_data = {{
{{ SC_(0), SC_(0.23917420208454132080078125e0), SC_(-0.96144387845032600014206252125473909797e0) }},
{{ SC_(0), SC_(0.1785583972930908203125e1), SC_(0.4741447443427281185149710186267060231689e0) }},
{{ SC_(0), SC_(0.48770198822021484375e1), SC_(-0.2878028614684715596290259912770720755831e0) }},
Modified: branches/release/libs/math/test/bessel_yn_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_yn_data.ipp (original)
+++ branches/release/libs/math/test/bessel_yn_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 300> bessel_yn_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 300> bessel_yn_data = {{
{{ SC_(0.3e1), SC_(0.48770198822021484375e1), SC_(0.110763167474753768460862899966350902213e0) }},
{{ SC_(0.3e1), SC_(0.6349340915679931640625e1), SC_(0.3354120577583840086404698897976135110485e0) }},
{{ SC_(0.3e1), SC_(0.677385044097900390625e1), SC_(0.3025179709577162581120705977708622170952e0) }},
Modified: branches/release/libs/math/test/bessel_yv_data.ipp
==============================================================================
--- branches/release/libs/math/test/bessel_yv_data.ipp (original)
+++ branches/release/libs/math/test/bessel_yv_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 432> bessel_yv_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 432> bessel_yv_data = {{
{{ SC_(0.177219114266335964202880859375e-2), SC_(0.177219114266335964202880859375e-2), SC_(-0.4109981080896677237358777348659577384814e1) }},
{{ SC_(0.177219114266335964202880859375e-2), SC_(0.22177286446094512939453125e-2), SC_(-0.3967198166482792888587309535339999462266e1) }},
{{ SC_(0.177219114266335964202880859375e-2), SC_(0.7444499991834163665771484375e-2), SC_(-0.3196174808457488271204616814902805588745e1) }},
Modified: branches/release/libs/math/test/beta_exp_data.ipp
==============================================================================
--- branches/release/libs/math/test/beta_exp_data.ipp (original)
+++ branches/release/libs/math/test/beta_exp_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 351> beta_exp_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 351> beta_exp_data = { {
{{ SC_(0.1730655412757187150418758392333984375e-5), SC_(0.1730655412757187150418758392333984375e-5), SC_(1155631.551635027016649268884796909927277) }},
{{ SC_(0.216575062950141727924346923828125e-5), SC_(0.1730655412757187150418758392333984375e-5), SC_(1039549.452063747329381617654200841254652) }},
{{ SC_(0.216575062950141727924346923828125e-5), SC_(0.216575062950141727924346923828125e-5), SC_(923467.3524924676425690820378921903570447) }},
Modified: branches/release/libs/math/test/beta_med_data.ipp
==============================================================================
--- branches/release/libs/math/test/beta_med_data.ipp (original)
+++ branches/release/libs/math/test/beta_med_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 1830> beta_med_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 1830> beta_med_data = { {
{{ SC_(0.4883005917072296142578125), SC_(0.4883005917072296142578125), SC_(3.245912809500479157065104747353807392371) }},
{{ SC_(3.5808107852935791015625), SC_(0.4883005917072296142578125), SC_(1.007653173802923954909901438393379243537) }},
{{ SC_(3.5808107852935791015625), SC_(3.5808107852935791015625), SC_(0.01354763979296020361276499134253466025558) }},
Modified: branches/release/libs/math/test/beta_small_data.ipp
==============================================================================
--- branches/release/libs/math/test/beta_small_data.ipp (original)
+++ branches/release/libs/math/test/beta_small_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 21> beta_small_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 21> beta_small_data = { {
{{ SC_(0.1730655412757187150418758392333984375e-5), SC_(0.1730655412757187150418758392333984375e-5), SC_(1155631.551635027016649268884796909927277) }},
{{ SC_(0.216575062950141727924346923828125e-5), SC_(0.1730655412757187150418758392333984375e-5), SC_(1039549.452063747329381617654200841254652) }},
{{ SC_(0.216575062950141727924346923828125e-5), SC_(0.216575062950141727924346923828125e-5), SC_(923467.3524924676425690820378921903570447) }},
Modified: branches/release/libs/math/test/binomial_data.ipp
==============================================================================
--- branches/release/libs/math/test/binomial_data.ipp (original)
+++ branches/release/libs/math/test/binomial_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 159> binomial_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 159> binomial_data = { {
{{ SC_(0.15e2), SC_(0.15e2), SC_(0.1e1) }},
{{ SC_(0.19e2), SC_(0.15e2), SC_(0.3876e4) }},
{{ SC_(0.19e2), SC_(0.19e2), SC_(0.1e1) }},
Modified: branches/release/libs/math/test/binomial_large_data.ipp
==============================================================================
--- branches/release/libs/math/test/binomial_large_data.ipp (original)
+++ branches/release/libs/math/test/binomial_large_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 230> binomial_large_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 230> binomial_large_data = { {
{{ SC_(0.174e3), SC_(0.4e1), SC_(0.36890001e8) }},
{{ SC_(0.174e3), SC_(0.5e1), SC_(0.1254260034e10) }},
{{ SC_(0.174e3), SC_(0.6e1), SC_(0.35328324291e11) }},
Modified: branches/release/libs/math/test/binomial_quantile.ipp
==============================================================================
--- branches/release/libs/math/test/binomial_quantile.ipp (original)
+++ branches/release/libs/math/test/binomial_quantile.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
static const boost::array<boost::array<T, 5>, 4032> binomial_quantile_data = {{
{{ SC_(2), SC_(0.12698681652545928955078125), SC_(0.12698681652545928955078125), SC_(0), SC_(0.28467385230321224203411154382440248724380832183117) }},
{{ SC_(2), SC_(0.12698681652545928955078125), SC_(0.135477006435394287109375), SC_(0), SC_(0.25727865882740919932840773421531232758964168093055) }},
Modified: branches/release/libs/math/test/cbrt_data.ipp
==============================================================================
--- branches/release/libs/math/test/cbrt_data.ipp (original)
+++ branches/release/libs/math/test/cbrt_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 85> cbrt_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 85> cbrt_data = { {
{{ SC_(0.266297021326439287136622624529991298914e-12), SC_(0.1888421455001568264216782004847867296461e-37) }},
{{ SC_(0.5920415525016708979677559909760020673275e-12), SC_(0.2075183790343685754527643464587844863336e-36) }},
{{ SC_(0.155163989296047688526414276566356420517e-11), SC_(0.3735707037930203997047439019589434984292e-35) }},
Modified: branches/release/libs/math/test/compile_test/instantiate.hpp
==============================================================================
--- branches/release/libs/math/test/compile_test/instantiate.hpp (original)
+++ branches/release/libs/math/test/compile_test/instantiate.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -232,12 +232,23 @@
boost::math::sph_bessel(i, 1);
boost::math::sph_neumann(i, v2);
boost::math::sph_neumann(i, i);
+#ifdef TEST_COMPLEX
+ boost::math::cyl_hankel_1(v1, v2);
+ boost::math::cyl_hankel_1(i, v2);
+ boost::math::cyl_hankel_2(v1, v2);
+ boost::math::cyl_hankel_2(i, v2);
+ boost::math::sph_hankel_1(v1, v2);
+ boost::math::sph_hankel_1(i, v2);
+ boost::math::sph_hankel_2(v1, v2);
+ boost::math::sph_hankel_2(i, v2);
+#endif
boost::math::expint(v1);
boost::math::expint(i);
boost::math::expint(i, v2);
boost::math::expint(i, i);
boost::math::zeta(v1);
boost::math::zeta(i);
+ boost::math::owens_t(v1, v2);
boost::math::trunc(v1);
boost::math::itrunc(v1);
boost::math::ltrunc(v1);
@@ -350,12 +361,23 @@
boost::math::sph_bessel(i, 1, pol);
boost::math::sph_neumann(i, v2, pol);
boost::math::sph_neumann(i, i, pol);
+#ifdef TEST_COMPLEX
+ boost::math::cyl_hankel_1(v1, v2, pol);
+ boost::math::cyl_hankel_1(i, v2, pol);
+ boost::math::cyl_hankel_2(v1, v2, pol);
+ boost::math::cyl_hankel_2(i, v2, pol);
+ boost::math::sph_hankel_1(v1, v2, pol);
+ boost::math::sph_hankel_1(i, v2, pol);
+ boost::math::sph_hankel_2(v1, v2, pol);
+ boost::math::sph_hankel_2(i, v2, pol);
+#endif
boost::math::expint(v1, pol);
boost::math::expint(i, pol);
boost::math::expint(i, v2, pol);
boost::math::expint(i, i, pol);
boost::math::zeta(v1, pol);
boost::math::zeta(i, pol);
+ boost::math::owens_t(v1, v2, pol);
//
// These next functions are intended to be found via ADL:
//
@@ -479,12 +501,23 @@
test::sph_bessel(i, 1);
test::sph_neumann(i, v2);
test::sph_neumann(i, i);
+#ifdef TEST_COMPLEX
+ test::cyl_hankel_1(v1, v2);
+ test::cyl_hankel_1(i, v2);
+ test::cyl_hankel_2(v1, v2);
+ test::cyl_hankel_2(i, v2);
+ test::sph_hankel_1(v1, v2);
+ test::sph_hankel_1(i, v2);
+ test::sph_hankel_2(v1, v2);
+ test::sph_hankel_2(i, v2);
+#endif
test::expint(v1);
test::expint(i);
test::expint(i, v2);
test::expint(i, i);
test::zeta(v1);
test::zeta(i);
+ test::owens_t(v1, v2);
test::trunc(v1);
test::itrunc(v1);
test::ltrunc(v1);
@@ -636,6 +669,8 @@
boost::math::sph_bessel(i, 1);
boost::math::sph_neumann(i, lr);
boost::math::sph_neumann(i, i);
+ boost::math::owens_t(fr, dr);
+ boost::math::owens_t(i, s);
boost::math::policies::policy<> pol;
@@ -747,6 +782,8 @@
boost::math::sph_bessel(i, 1, pol);
boost::math::sph_neumann(i, lr, pol);
boost::math::sph_neumann(i, i, pol);
+ boost::math::owens_t(fr, dr, pol);
+ boost::math::owens_t(i, s, pol);
test::tgamma(i);
@@ -861,6 +898,8 @@
test::sph_bessel(i, 1);
test::sph_neumann(i, lr);
test::sph_neumann(i, i);
+ test::owens_t(fr, dr);
+ test::owens_t(i, s);
#endif
}
Modified: branches/release/libs/math/test/complex_test.cpp
==============================================================================
--- branches/release/libs/math/test/complex_test.cpp (original)
+++ branches/release/libs/math/test/complex_test.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -271,11 +271,10 @@
static const T zero = 0;
static const T mzero = -zero;
static const T one = 1;
- static const T pi = static_cast<T>(3.141592653589793238462643383279502884197L);
- static const T half_pi = static_cast<T>(1.57079632679489661923132169163975144L);
- static const T quarter_pi = static_cast<T>(0.78539816339744830961566084581987572L);
- static const T three_quarter_pi = static_cast<T>(2.35619449019234492884698253745962716L);
- //static const T log_two = static_cast<T>(0.69314718055994530941723212145817657L);
+ static const T pi = boost::math::constants::pi<T>();
+ static const T half_pi = boost::math::constants::half_pi<T>();
+ static const T quarter_pi = half_pi / 2;
+ static const T three_quarter_pi = boost::math::constants::three_quarters_pi<T>();
T infinity = std::numeric_limits<T>::infinity();
bool test_infinity = std::numeric_limits<T>::has_infinity;
T nan = 0;
Modified: branches/release/libs/math/test/digamma_data.ipp
==============================================================================
--- branches/release/libs/math/test/digamma_data.ipp (original)
+++ branches/release/libs/math/test/digamma_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 500> digamma_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 500> digamma_data = { {
{{ SC_(2.818432331085205078125), SC_(0.8484115700906551606307984398000472347785) }},
{{ SC_(4.6342258453369140625), SC_(1.421713669467331557347601964119226105014) }},
{{ SC_(4.783483982086181640625), SC_(1.457016504476551729585831562031964212238) }},
Modified: branches/release/libs/math/test/digamma_neg_data.ipp
==============================================================================
--- branches/release/libs/math/test/digamma_neg_data.ipp (original)
+++ branches/release/libs/math/test/digamma_neg_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 200> digamma_neg_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 200> digamma_neg_data = { {
{{ SC_(-99.7181549072265625), SC_(2.03892909952497242038694056382195623059) }},
{{ SC_(-99.5216522216796875), SC_(4.3913617771941913117971009646096341326) }},
{{ SC_(-98.80979156494140625), SC_(-0.01795976054399933340057713377738267488686) }},
Modified: branches/release/libs/math/test/digamma_root_data.ipp
==============================================================================
--- branches/release/libs/math/test/digamma_root_data.ipp (original)
+++ branches/release/libs/math/test/digamma_root_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 200> digamma_root_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 200> digamma_root_data = { {
{{ SC_(1.39999997615814208984375), SC_(-0.06138456903152256550686860248931989075643) }},
{{ SC_(1.4005000591278076171875), SC_(-0.06087192929516339380130503872301167293378) }},
{{ SC_(1.40100002288818359375), SC_(-0.06035965880979232302674791723368356347747) }},
Modified: branches/release/libs/math/test/digamma_small_data.ipp
==============================================================================
--- branches/release/libs/math/test/digamma_small_data.ipp (original)
+++ branches/release/libs/math/test/digamma_small_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 33> digamma_small_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 33> digamma_small_data = { {
{{ SC_(0.1690093176520690576580818742513656616211e-8), SC_(-591683355.0172646248558707395909205014789) }},
{{ SC_(0.2114990849122477811761200428009033203125e-8), SC_(-472815285.0570071002693788265718597340393) }},
{{ SC_(0.7099628440698779741069301962852478027344e-8), SC_(-140852442.1314070676912450420112690472767) }},
Modified: branches/release/libs/math/test/ellint_e2_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_e2_data.ipp (original)
+++ branches/release/libs/math/test/ellint_e2_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
//
// k, phi, E(k, phi)
//
- static const boost::array<boost::array<T, 3>, 520> ellint_e2_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 520> ellint_e2_data = {{
{{ SC_(0.177219114266335964202880859375e-2), SC_(-0.804919183254241943359375e0), SC_(0.17721905416489978459933452744691987573693030723399e-2) }},
{{ SC_(0.177219114266335964202880859375e-2), SC_(-0.74602639675140380859375e0), SC_(0.17721906263793616232304803862551613935165980878975e-2) }},
{{ SC_(0.177219114266335964202880859375e-2), SC_(-0.72904598712921142578125e0), SC_(0.17721906496143189532808590572077500756745196250994e-2) }},
Modified: branches/release/libs/math/test/ellint_e_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_e_data.ipp (original)
+++ branches/release/libs/math/test/ellint_e_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
//
// k, E(k)
//
- static const boost::array<boost::array<T, 2>, 100> ellint_e_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 100> ellint_e_data = {{
{{ SC_(-0.990433037281036376953125e0), SC_(0.10274527688571687030049782227296053357094496206279e1) }},
{{ SC_(-0.936334311962127685546875e0), SC_(0.11232874555917022066938321555637623562213676975972e1) }},
{{ SC_(-0.931107819080352783203125e0), SC_(0.1130760221755419903369153157619439589360779303926e1) }},
Modified: branches/release/libs/math/test/ellint_f_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_f_data.ipp (original)
+++ branches/release/libs/math/test/ellint_f_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -8,7 +8,7 @@
//
// phi, k, ellint_1(k, phi)
//
- static const boost::array<boost::array<T, 3>, 610> ellint_f_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 610> ellint_f_data = {{
{{ SC_(0.177219114266335964202880859375e-2), SC_(0.12698681652545928955078125e0), SC_(0.17721911576221833285284471505772299979929420100157e-2) }},
{{ SC_(0.177219114266335964202880859375e-2), SC_(0.135477006435394287109375e0), SC_(0.17721911596893097495385621130075639520810631802367e-2) }},
{{ SC_(0.177219114266335964202880859375e-2), SC_(0.22103404998779296875e0), SC_(0.17721911879842626333735727252300568988042608181058e-2) }},
Modified: branches/release/libs/math/test/ellint_k_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_k_data.ipp (original)
+++ branches/release/libs/math/test/ellint_k_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 100> ellint_k_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 100> ellint_k_data = {{
{{ SC_(-0.99042308330535888671875e0), SC_(0.3377711175347896212115917173531827081735908096628e1) }},
{{ SC_(-0.936324596405029296875e0), SC_(0.24799928378892127263868582279024816073017669022263e1) }},
{{ SC_(-0.931098163127899169921875e0), SC_(0.24445366497109921574142184681825951967450363552834e1) }},
Modified: branches/release/libs/math/test/ellint_pi2_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_pi2_data.ipp (original)
+++ branches/release/libs/math/test/ellint_pi2_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
//
// n, k, PI(n, k)
//
- static const boost::array<boost::array<T, 3>, 500> ellint_pi2_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 500> ellint_pi2_data = {{
{{ SC_(-0.871743316650390625e2), SC_(0.12698681652545928955078125e0), SC_(0.1674125184786922275852201144520277497358358213892e0) }},
{{ SC_(-0.871743316650390625e2), SC_(0.135477006435394287109375e0), SC_(0.16743071541243053183466547814319460702264753849723e0) }},
{{ SC_(-0.871743316650390625e2), SC_(0.22103404998779296875e0), SC_(0.16768328087467940131221559947745677007068360020936e0) }},
Modified: branches/release/libs/math/test/ellint_pi3_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_pi3_data.ipp (original)
+++ branches/release/libs/math/test/ellint_pi3_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
//
// n, phi, k, PI(n, phi, k)
//
- static const boost::array<boost::array<T, 4>, 400> ellint_pi3_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 400> ellint_pi3_data = {{
{{ SC_(0.97540400922298431396484375e-1), SC_(0.15321610867977142333984375e0), SC_(0.814723670482635498046875e0), SC_(0.15373203842748125370338546651780574888816846402842e0) }},
{{ SC_(0.97540400922298431396484375e-1), SC_(0.1994704306125640869140625e0), SC_(0.135477006435394287109375e0), SC_(0.19975117232566753482238350513231879856319046077755e0) }},
{{ SC_(0.97540400922298431396484375e-1), SC_(0.2128067910671234130859375e0), SC_(0.905791938304901123046875e0), SC_(0.21444962146028791552496083456124507126701014421723e0) }},
Modified: branches/release/libs/math/test/ellint_pi3_large_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_pi3_large_data.ipp (original)
+++ branches/release/libs/math/test/ellint_pi3_large_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
//
// n, phi, k, PI(n, phi, k)
//
- static const boost::array<boost::array<T, 4>, 380> ellint_pi3_large_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 380> ellint_pi3_large_data = {{
{{ SC_(-0.882951507568359375e2), SC_(-0.80491924285888671875e1), SC_(0.814723670482635498046875e0), SC_(-0.87472421400728425336727040442604900083192977041785e0) }},
{{ SC_(-0.882951507568359375e2), SC_(-0.7460263729095458984375e1), SC_(0.135477006435394287109375e0), SC_(-0.82718880423302271609361236805097048706326618138613e0) }},
{{ SC_(-0.882951507568359375e2), SC_(-0.729045963287353515625e1), SC_(0.905791938304901123046875e0), SC_(-0.87747551276758882959544200152954525505618423971659e0) }},
Modified: branches/release/libs/math/test/ellint_rc_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_rc_data.ipp (original)
+++ branches/release/libs/math/test/ellint_rc_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
//
// x, y, RC(x, y)
//
- static const boost::array<boost::array<T, 3>, 201> ellint_rc_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 201> ellint_rc_data = {{
{{ SC_(0.11698430441812742785454260394458960094979845402414e-30), SC_(0.1429457475085533184e20), SC_(0.41546482167023371731518451342517736095263780557582e-9) }},
{{ SC_(0.60682196926171104626767727515008970841312337712241e-30), SC_(0.20031258624e11), SC_(0.11098537606275153066313383027431717728910787699004e-4) }},
{{ SC_(0.75974287571611502022633594876763844865744160884209e-30), SC_(0.20657736771171195551744e23), SC_(0.10928951720653730370271800759007590309935803177545e-10) }},
Modified: branches/release/libs/math/test/ellint_rd_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_rd_data.ipp (original)
+++ branches/release/libs/math/test/ellint_rd_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
//
// x, y, z, RD(x, y, z)
//
- static const boost::array<boost::array<T, 4>, 201> ellint_rd_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 201> ellint_rd_data = {{
{{ SC_(0.60682196926171104626767727515008970841312337712241e-30), SC_(0.20031258624e11), SC_(0.10313978271484375e4), SC_(0.20551372495384815463856604017047221545095240191057e-7) }},
{{ SC_(0.13810928266794127506964991575307193802925529863273e-29), SC_(0.2529551275074481964111328125e-3), SC_(0.7030536597341097149183042347431182861328125e-8), SC_(0.26827491422802771467722943731540343461246213838861e11) }},
{{ SC_(0.44767214645416419053919245787147718165594030426536e-29), SC_(0.26553176031232e14), SC_(0.2085586588137791946752e23), SC_(0.10585138723496739834534066073267118675522211779171e-31) }},
Modified: branches/release/libs/math/test/ellint_rf_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_rf_data.ipp (original)
+++ branches/release/libs/math/test/ellint_rf_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
//
// x, y, z, RF(x, y, z)
//
- static const boost::array<boost::array<T, 4>, 401> ellint_rf_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 401> ellint_rf_data = {{
{{ SC_(0.60682196926171104626767727515008970841312337712241e-30), SC_(0.20031258624e11), SC_(0.10313978271484375e4), SC_(0.69081557947567857896297308369623231790841946303168e-4) }},
{{ SC_(0.13810928266794127506964991575307193802925529863273e-29), SC_(0.2529551275074481964111328125e-3), SC_(0.7030536597341097149183042347431182861328125e-8), SC_(0.41696748464385961137940994051143282877208328256968e3) }},
{{ SC_(0.14532352659780781796355564562931230420316401288775e-29), SC_(0.62687453931329231730011467674071804187172354186889e-30), SC_(0.26256847716031594952568184453411959111690521240234e-12), SC_(0.40492940437281068910143789937423107620726714449588e8) }},
Modified: branches/release/libs/math/test/ellint_rj_data.ipp
==============================================================================
--- branches/release/libs/math/test/ellint_rj_data.ipp (original)
+++ branches/release/libs/math/test/ellint_rj_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
//
// x, y, z, p, RF(x, y, z, p)
//
- static const boost::array<boost::array<T, 5>, 801> ellint_rj_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 5>, 801> ellint_rj_data = {{
{{ SC_(0.17778719640226356167347852945229440308832650104108e-30), SC_(0.140657017848070144e19), SC_(0.1004598712921142578125e2), SC_(-0.482979822802320768460049293935298919677734375e-9), SC_(-0.25179478604244669733973586875090503552089558764187e-9) }},
{{ SC_(0.17971096343704528451751984491965084147481741634467e-30), SC_(0.89101844176293009628514463216220065078232437372208e-17), SC_(0.83764338663550372334498751058362691151424505491344e-28), SC_(0.25525904358368192101317869568e29), SC_(0.55264196567924337745014728862252651162552511364961e-18) }},
{{ SC_(0.3374483874642825322028299383742755000492569610633e-30), SC_(0.46577155087788907954176e23), SC_(0.46983051300048828125e0), SC_(-0.4337557424349824941600672900676727294921875e-8), SC_(-0.29586494691174345632763961304004697052773087913144e-10) }},
Modified: branches/release/libs/math/test/erf_data.ipp
==============================================================================
--- branches/release/libs/math/test/erf_data.ipp (original)
+++ branches/release/libs/math/test/erf_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 500> erf_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 500> erf_data = { {
{{ SC_(-7.954905033111572265625), SC_(-0.9999999999999999999999999999768236114552), SC_(1.999999999999999999999999999976823611455) }},
{{ SC_(-7.925852298736572265625), SC_(-0.9999999999999999999999999999631035087875), SC_(1.999999999999999999999999999963103508787) }},
{{ SC_(-7.923464298248291015625), SC_(-0.9999999999999999999999999999616689085769), SC_(1.999999999999999999999999999961668908577) }},
Modified: branches/release/libs/math/test/erf_inv_data.ipp
==============================================================================
--- branches/release/libs/math/test/erf_inv_data.ipp (original)
+++ branches/release/libs/math/test/erf_inv_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 100> erf_inv_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 100> erf_inv_data = { {
{{ SC_(-0.990433037281036376953125), SC_(-1.832184533179510927322805923563700329767) }},
{{ SC_(-0.936334311962127685546875), SC_(-1.311339282092737086640055105484822812599) }},
{{ SC_(-0.931107819080352783203125), SC_(-1.286316461685184857889337272829270644576) }},
Modified: branches/release/libs/math/test/erf_large_data.ipp
==============================================================================
--- branches/release/libs/math/test/erf_large_data.ipp (original)
+++ branches/release/libs/math/test/erf_large_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 300> erf_large_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 300> erf_large_data = { {
{{ SC_(8.2311115264892578125), SC_(0.9999999999999999999999999999997436415644), SC_(0.2563584356432915693836191701249115171878e-30) }},
{{ SC_(8.3800067901611328125), SC_(0.9999999999999999999999999999999787664373), SC_(0.212335626810981756102114466368867764939e-31) }},
{{ SC_(8.39224529266357421875), SC_(0.9999999999999999999999999999999827316301), SC_(0.1726836993826464997300336080711750877816e-31) }},
Modified: branches/release/libs/math/test/erf_small_data.ipp
==============================================================================
--- branches/release/libs/math/test/erf_small_data.ipp (original)
+++ branches/release/libs/math/test/erf_small_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 150> erf_small_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 150> erf_small_data = { {
{{ SC_(0), SC_(0), SC_(1) }},
{{ SC_(0.140129846432481707092372958328991613128e-44), SC_(0.1581195994027057927040695988659415347357e-44), SC_(1) }},
{{ SC_(0.2802596928649634141847459166579832262561e-44), SC_(0.3162391988054115854081391977318830694715e-44), SC_(1) }},
Modified: branches/release/libs/math/test/erfc_inv_big_data.ipp
==============================================================================
--- branches/release/libs/math/test/erfc_inv_big_data.ipp (original)
+++ branches/release/libs/math/test/erfc_inv_big_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 200> erfc_inv_big_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 200> erfc_inv_big_data = { {
{{ SC_(0.5460825444184401149953083908674803067585e-4312), SC_(99.62016927389407649911084501709563799849) }},
{{ SC_(0.2645475979732877501542006305722535728925e-4291), SC_(99.38083815930157675670279543643240126733) }},
{{ SC_(0.4647218972549971591905525747707221131215e-4281), SC_(99.26209205835381203650501813598769577392) }},
Modified: branches/release/libs/math/test/erfc_inv_data.ipp
==============================================================================
--- branches/release/libs/math/test/erfc_inv_data.ipp (original)
+++ branches/release/libs/math/test/erfc_inv_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 100> erfc_inv_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 100> erfc_inv_data = { {
{{ SC_(0.00956696830689907073974609375), SC_(1.832184391051582711731256541599359331735) }},
{{ SC_(0.063665688037872314453125), SC_(1.311339282092737086640055105484822812599) }},
{{ SC_(0.068892158567905426025390625), SC_(1.286316565305373898738127895195338854718) }},
Modified: branches/release/libs/math/test/expint_1_data.ipp
==============================================================================
--- branches/release/libs/math/test/expint_1_data.ipp (original)
+++ branches/release/libs/math/test/expint_1_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 79> expint_1_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 79> expint_1_data = {{
{{ SC_(1), SC_(0.1690093176520690576580818742513656616211e-8), SC_(19.62126651228390287899433646349668926594) }},
{{ SC_(1), SC_(0.2114990849122477811761200428009033203125e-8), SC_(19.39699968832702671432639506875262488287) }},
{{ SC_(1), SC_(0.7099628440698779741069301962852478027344e-8), SC_(18.18600772876256587669156181753338435097) }},
Modified: branches/release/libs/math/test/expint_data.ipp
==============================================================================
--- branches/release/libs/math/test/expint_data.ipp (original)
+++ branches/release/libs/math/test/expint_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 600> expint_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 600> expint_data = {{
{{ SC_(0), SC_(4.8770198822021484375), SC_(0.001562365538135970995717852896857631808327) }},
{{ SC_(0), SC_(5.4930877685546875), SC_(0.0007491447757702025944722131745633334937684) }},
{{ SC_(0), SC_(6.349340915679931640625), SC_(0.0002752882216582873387067996572122917865872) }},
Modified: branches/release/libs/math/test/expint_small_data.ipp
==============================================================================
--- branches/release/libs/math/test/expint_small_data.ipp (original)
+++ branches/release/libs/math/test/expint_small_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 380> expint_small_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 380> expint_small_data = {{
{{ SC_(0), SC_(0.1730655412757187150418758392333984375e-5), SC_(577814.7758212256423775256378551874856003) }},
{{ SC_(0), SC_(0.216575062950141727924346923828125e-5), SC_(461732.6762508792015318981937822200350918) }},
{{ SC_(0), SC_(0.72700195232755504548549652099609375e-5), SC_(137550.2124589000541443257494936989244997) }},
Modified: branches/release/libs/math/test/expinti_data.ipp
==============================================================================
--- branches/release/libs/math/test/expinti_data.ipp (original)
+++ branches/release/libs/math/test/expinti_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 336> expinti_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 336> expinti_data = {{
{{ SC_(-49.689971923828125), SC_(-0.5189914452467706181911213069148082266893e-23) }},
{{ SC_(-49.490234375), SC_(-0.6362401135264284153452455085506782750647e-23) }},
{{ SC_(-49.47381591796875), SC_(-0.6469829627301154800340680350229540167762e-23) }},
Modified: branches/release/libs/math/test/expinti_data_double.ipp
==============================================================================
--- branches/release/libs/math/test/expinti_data_double.ipp (original)
+++ branches/release/libs/math/test/expinti_data_double.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 100> expinti_data_double = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 100> expinti_data_double = {{
{{ SC_(102.87009429931640625), SC_(4654899469800805764672952463660041015404000.0) }},
{{ SC_(119.09970855712890625), SC_(0.4488787864805080932333174640972770490538e50) }},
{{ SC_(120.6676483154296875), SC_(0.2124946028694675872596376925084081671409e51) }},
Modified: branches/release/libs/math/test/expinti_data_long.ipp
==============================================================================
--- branches/release/libs/math/test/expinti_data_long.ipp (original)
+++ branches/release/libs/math/test/expinti_data_long.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 100> expinti_data_long = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 100> expinti_data_long = {{
{{ SC_(850.51361083984375), SC_(0.27809823533792637952061836944224670902e367) }},
{{ SC_(1136.15478515625), SC_(0.2348005093803919554840423708437417479629e491) }},
{{ SC_(1163.7506103515625), SC_(0.2213003663371766101124862788858798209669e503) }},
Modified: branches/release/libs/math/test/functor.hpp
==============================================================================
--- branches/release/libs/math/test/functor.hpp (original)
+++ branches/release/libs/math/test/functor.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -9,12 +9,13 @@
#ifndef BOOST_MATH_TEST_FUNCTOR_HPP
#define BOOST_MATH_TEST_FUNCTOR_HPP
+template <class Real>
struct extract_result_type
{
extract_result_type(unsigned i) : m_location(i){}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
return row[m_location];
}
@@ -22,18 +23,19 @@
unsigned m_location;
};
-inline extract_result_type extract_result(unsigned i)
+template <class Real>
+inline extract_result_type<Real> extract_result(unsigned i)
{
- return extract_result_type(i);
+ return extract_result_type<Real>(i);
}
-template <class F>
+template <class Real, class F>
struct row_binder1
{
row_binder1(F _f, unsigned i) : f(_f), m_i(i) {}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
return f(row[m_i]);
}
@@ -43,19 +45,19 @@
unsigned m_i;
};
-template<class F>
-inline row_binder1<F> bind_func(F f, unsigned i)
+template<class Real, class F>
+inline row_binder1<Real, F> bind_func(F f, unsigned i)
{
- return row_binder1<F>(f, i);
+ return row_binder1<Real, F>(f, i);
}
-template <class F>
+template <class Real, class F>
struct row_binder2
{
row_binder2(F _f, unsigned i, unsigned j) : f(_f), m_i(i), m_j(j) {}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
return f(row[m_i], row[m_j]);
}
@@ -65,19 +67,19 @@
unsigned m_i, m_j;
};
-template<class F>
-inline row_binder2<F> bind_func(F f, unsigned i, unsigned j)
+template<class Real, class F>
+inline row_binder2<Real, F> bind_func(F f, unsigned i, unsigned j)
{
- return row_binder2<F>(f, i, j);
+ return row_binder2<Real, F>(f, i, j);
}
-template <class F>
+template <class Real, class F>
struct row_binder3
{
row_binder3(F _f, unsigned i, unsigned j, unsigned k) : f(_f), m_i(i), m_j(j), m_k(k) {}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
return f(row[m_i], row[m_j], row[m_k]);
}
@@ -87,19 +89,19 @@
unsigned m_i, m_j, m_k;
};
-template<class F>
-inline row_binder3<F> bind_func(F f, unsigned i, unsigned j, unsigned k)
+template<class Real, class F>
+inline row_binder3<Real, F> bind_func(F f, unsigned i, unsigned j, unsigned k)
{
- return row_binder3<F>(f, i, j, k);
+ return row_binder3<Real, F>(f, i, j, k);
}
-template <class F>
+template <class Real, class F>
struct row_binder4
{
row_binder4(F _f, unsigned i, unsigned j, unsigned k, unsigned l) : f(_f), m_i(i), m_j(j), m_k(k), m_l(l) {}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
return f(row[m_i], row[m_j], row[m_k], row[m_l]);
}
@@ -109,21 +111,21 @@
unsigned m_i, m_j, m_k, m_l;
};
-template<class F>
-inline row_binder4<F> bind_func(F f, unsigned i, unsigned j, unsigned k, unsigned l)
+template<class Real, class F>
+inline row_binder4<Real, F> bind_func(F f, unsigned i, unsigned j, unsigned k, unsigned l)
{
- return row_binder4<F>(f, i, j, k, l);
+ return row_binder4<Real, F>(f, i, j, k, l);
}
-template <class F>
+template <class Real, class F>
struct row_binder2_i1
{
row_binder2_i1(F _f, unsigned i, unsigned j) : f(_f), m_i(i), m_j(j) {}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
- return f(boost::math::itrunc(row[m_i]), row[m_j]);
+ return f(boost::math::itrunc(Real(row[m_i])), row[m_j]);
}
private:
@@ -131,23 +133,23 @@
unsigned m_i, m_j;
};
-template<class F>
-inline row_binder2_i1<F> bind_func_int1(F f, unsigned i, unsigned j)
+template<class Real, class F>
+inline row_binder2_i1<Real, F> bind_func_int1(F f, unsigned i, unsigned j)
{
- return row_binder2_i1<F>(f, i, j);
+ return row_binder2_i1<Real, F>(f, i, j);
}
-template <class F>
+template <class Real, class F>
struct row_binder3_i2
{
row_binder3_i2(F _f, unsigned i, unsigned j, unsigned k) : f(_f), m_i(i), m_j(j), m_k(k) {}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
return f(
- boost::math::itrunc(row[m_i]),
- boost::math::itrunc(row[m_j]),
+ boost::math::itrunc(Real(row[m_i])),
+ boost::math::itrunc(Real(row[m_j])),
row[m_k]);
}
@@ -156,23 +158,23 @@
unsigned m_i, m_j, m_k;
};
-template<class F>
-inline row_binder3_i2<F> bind_func_int2(F f, unsigned i, unsigned j, unsigned k)
+template<class Real, class F>
+inline row_binder3_i2<Real, F> bind_func_int2(F f, unsigned i, unsigned j, unsigned k)
{
- return row_binder3_i2<F>(f, i, j, k);
+ return row_binder3_i2<Real, F>(f, i, j, k);
}
-template <class F>
+template <class Real, class F>
struct row_binder4_i2
{
row_binder4_i2(F _f, unsigned i, unsigned j, unsigned k, unsigned l) : f(_f), m_i(i), m_j(j), m_k(k), m_l(l) {}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
return f(
- boost::math::itrunc(row[m_i]),
- boost::math::itrunc(row[m_j]),
+ boost::math::itrunc(Real(row[m_i])),
+ boost::math::itrunc(Real(row[m_j])),
row[m_k],
row[m_l]);
}
@@ -182,30 +184,30 @@
unsigned m_i, m_j, m_k, m_l;
};
-template<class F>
-inline row_binder4_i2<F> bind_func_int2(F f, unsigned i, unsigned j, unsigned k, unsigned l)
+template<class Real, class F>
+inline row_binder4_i2<Real, F> bind_func_int2(F f, unsigned i, unsigned j, unsigned k, unsigned l)
{
- return row_binder4_i2<F>(f, i, j, k, l);
+ return row_binder4_i2<Real, F>(f, i, j, k, l);
}
-template <class F>
+template <class Real, class F>
struct negate_type
{
negate_type(F f) : m_f(f){}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
- return -m_f(row);
+ return -Real(m_f(row));
}
private:
F m_f;
};
-template <class F>
-inline negate_type<F> negate(F f)
+template <class Real, class F>
+inline negate_type<Real, F> negate(F f)
{
- return negate_type<F>(f);
+ return negate_type<Real, F>(f);
}
#endif
Modified: branches/release/libs/math/test/gamma_inv_big_data.ipp
==============================================================================
--- branches/release/libs/math/test/gamma_inv_big_data.ipp (original)
+++ branches/release/libs/math/test/gamma_inv_big_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 130> gamma_inv_big_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 130> gamma_inv_big_data = { {
{{ SC_(464.56927490234375), SC_(0.12698681652545928955078125), SC_(440.0905015614498663381793089656310373835539712118699915057655756381750702144551901256933419148259778), SC_(489.2489328115381710888005650788332818303123263238882523231037266766796974176786885492715539575179927) }},
{{ SC_(464.56927490234375), SC_(0.135477006435394287109375), SC_(440.9201626373476098986751145295281211597851207555116002836559277456581502883881279408150408804624974), SC_(488.3596775997958518494466317847702951287228545295142304855338082929544530999908165788368449119633373) }},
{{ SC_(464.56927490234375), SC_(0.22103404998779296875), SC_(447.8707097559117500373730010123474103179731538915785876172851019700931527209673015311979439047788638), SC_(480.9951697728710868281134950146803822897647194680614404153327850687509247330919989892805468881282719) }},
Modified: branches/release/libs/math/test/gamma_inv_data.ipp
==============================================================================
--- branches/release/libs/math/test/gamma_inv_data.ipp (original)
+++ branches/release/libs/math/test/gamma_inv_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 200> gamma_inv_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 200> gamma_inv_data = { {
{{ SC_(9.754039764404296875), SC_(0.12698681652545928955078125), SC_(6.349849983781954486964960115093039567468747967664820851534065876063014180392060424555352423162443804), SC_(13.35954665556050630769710564071384909890705633863167415813992116806093647564994418684947673739937248) }},
{{ SC_(9.754039764404296875), SC_(0.135477006435394287109375), SC_(6.443655518427200469944002789678415067225918847146256390238048987798948404483563975737891105237977816), SC_(13.20648307403762788665455912344161337928185855631083250140430065533748994841668643195553261756810763) }},
{{ SC_(9.754039764404296875), SC_(0.22103404998779296875), SC_(7.262299107203547511919478506673940833772294421637239641242141768466064388735007729524335022945474356), SC_(11.97587613793353953360795933135034836336725275703898828955465276118339699687746564051854946108002967) }},
Modified: branches/release/libs/math/test/gamma_inv_small_data.ipp
==============================================================================
--- branches/release/libs/math/test/gamma_inv_small_data.ipp (original)
+++ branches/release/libs/math/test/gamma_inv_small_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 229> gamma_inv_small_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 229> gamma_inv_small_data = { {
{{ SC_(0.1730655412757187150418758392333984375e-5), SC_(0.12698681652545928955078125), SC_(BOOST_MATH_SMALL_CONSTANT(0.2239623606222809074122747811596115646210220735131141509259977248899758059576948436798908594057794725e-517862)), SC_(BOOST_MATH_SMALL_CONSTANT(0.4348301951174619607003912855228982264838968134589390827069898370149065135278987288014463439625604227e-34079)) }},
{{ SC_(0.1730655412757187150418758392333984375e-5), SC_(0.135477006435394287109375), SC_(BOOST_MATH_SMALL_CONSTANT(0.9832661142546970309065948494116195914044751609094617663675341704778529043412686011701793912754530322e-501622)), SC_(BOOST_MATH_SMALL_CONSTANT(0.174464879621346471044494182889773112103066192989857880445657763562407515813032064473382568887549155e-36531)) }},
{{ SC_(0.1730655412757187150418758392333984375e-5), SC_(0.22103404998779296875), SC_(BOOST_MATH_SMALL_CONSTANT(0.8367188988033804556441828789142666841098768711906267440588049611090664598162301930590308375972597743e-378782)), SC_(BOOST_MATH_SMALL_CONSTANT(0.258455732678645501224573885451125893770282157149004436646252270592694652815341234774299743101856032e-62682)) }},
Modified: branches/release/libs/math/test/hermite.ipp
==============================================================================
--- branches/release/libs/math/test/hermite.ipp (original)
+++ branches/release/libs/math/test/hermite.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 420> hermite = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 420> hermite = {{
{{ SC_(0.8e1), SC_(-0.804919189453125e3), SC_(0.45107507538695517471998224862706929168983312035236e26) }},
{{ SC_(0.8e1), SC_(-0.7460263671875e3), SC_(0.24561928260207418635049717146784087504133748838575e26) }},
{{ SC_(0.8e1), SC_(-0.72904595947265625e3), SC_(0.20429972623973894937590136235800300689033201111301e26) }},
Modified: branches/release/libs/math/test/hypergeometric_dist_data2.ipp
==============================================================================
--- branches/release/libs/math/test/hypergeometric_dist_data2.ipp (original)
+++ branches/release/libs/math/test/hypergeometric_dist_data2.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -8,7 +8,7 @@
// (5) are commented out as they are too close to numeric_limits<double>::min(), to expect
// our implementation to cope :-(
//
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
static const boost::array<boost::array<T, 7>, 1542-5> hypergeometric_dist_data2 = {{
{{ SC_(3), SC_(3), SC_(4), SC_(3), SC_(0.25), SC_(1), SC_(0) }},
{{ SC_(3), SC_(3), SC_(15), SC_(1), SC_(0.4351648351648351648351648351648351648351648351648351648351648351648351648351648351648351648351648352), SC_(0.9186813186813186813186813186813186813186813186813186813186813186813186813186813186813186813186813187), SC_(0.08131868131868131868131868131868131868131868131868131868131868131868131868131868131868131868131868132) }},
Modified: branches/release/libs/math/test/hypergeometric_test_data.ipp
==============================================================================
--- branches/release/libs/math/test/hypergeometric_test_data.ipp (original)
+++ branches/release/libs/math/test/hypergeometric_test_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,7 +7,7 @@
// Test data generated by Mathematica, 104 values are commented out because they have only a low
// absolute error, not a low relative error.
//
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
static const boost::array<boost::array<T, 8>, 398-105> hypergeometric_test_data = {{
//{{SC_(1),SC_(1),SC_(2),SC_(1),SC_(0.5),SC_(1),SC_(0.e-40)}},
{{SC_(5),SC_(4),SC_(6),SC_(3),SC_(0.6666666666666666666666666666666666666667),SC_(0.6666666666666666666666666666666666666667),SC_(0.3333333333333333333333333333333333333333)}},
Modified: branches/release/libs/math/test/ibeta_data.ipp
==============================================================================
--- branches/release/libs/math/test/ibeta_data.ipp (original)
+++ branches/release/libs/math/test/ibeta_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 7>, 500> ibeta_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 7>, 500> ibeta_data = { {
{{ SC_(0.115105740725994110107421875), SC_(27.2666988372802734375), SC_(0.913345992565155029296875), SC_(5.624704191155661855917495760118550518449), SC_(0.4314397017151442751805333868688125395477e-30), SC_(0.9999999999999999999999999999999232955748), SC_(0.7670442516666816870156810539487652961219e-31) }},
{{ SC_(0.4634225666522979736328125), SC_(3.4317314624786376953125), SC_(0.24176712334156036376953125), SC_(0.9303555938707241359170267278058957882937), SC_(0.1886421251845313169553337074104181129545), SC_(0.8314186687138222136543152962911694480678), SC_(0.1685813312861777863456847037088305519322) }},
{{ SC_(0.671531736850738525390625), SC_(23.0631923675537109375), SC_(0.908442795276641845703125), SC_(0.1643292146089890181565750406388380802073), SC_(0.5052411887003343404176234528376913340103e-25), SC_(0.9999999999999999999999996925432949323565), SC_(0.3074567050676435237921994231096931905187e-24) }},
Modified: branches/release/libs/math/test/ibeta_int_data.ipp
==============================================================================
--- branches/release/libs/math/test/ibeta_int_data.ipp (original)
+++ branches/release/libs/math/test/ibeta_int_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 7>, 1000> ibeta_int_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 7>, 1000> ibeta_int_data = { {
{{ SC_(1), SC_(1), SC_(0.12707412242889404296875), SC_(0.12707412242889404296875), SC_(0.87292587757110595703125), SC_(0.12707412242889404296875), SC_(0.87292587757110595703125) }},
{{ SC_(1), SC_(1), SC_(0.1355634629726409912109375), SC_(0.1355634629726409912109375), SC_(0.8644365370273590087890625), SC_(0.1355634629726409912109375), SC_(0.8644365370273590087890625) }},
{{ SC_(1), SC_(1), SC_(0.221111953258514404296875), SC_(0.221111953258514404296875), SC_(0.778888046741485595703125), SC_(0.221111953258514404296875), SC_(0.778888046741485595703125) }},
Modified: branches/release/libs/math/test/ibeta_inv_data.ipp
==============================================================================
--- branches/release/libs/math/test/ibeta_inv_data.ipp (original)
+++ branches/release/libs/math/test/ibeta_inv_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 5>, 1210> ibeta_inv_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 5>, 1210> ibeta_inv_data = { {
{{ SC_(0.104760829344741068780422210693359375e-4), SC_(39078.1875), SC_(0.913384497165679931640625), SC_(0.2135769916611873809373928693612157637794870746322109915739746618652569766882593624385400901395922558e-3760), SC_(BOOST_MATH_SMALL_CONSTANT(0.6169146818683135737866366973021696361959736535710675458813428774517757535576031054239811928697394346e-101417)) }},
{{ SC_(0.1127331415773369371891021728515625e-4), SC_(0.0226620174944400787353515625), SC_(0.1355634629726409912109375), SC_(BOOST_MATH_SMALL_CONSTANT(0.6398069040886718270700942839013650119743974939592699138527850527236181568779785317811717302449254101e-76964)), SC_(BOOST_MATH_SMALL_CONSTANT(0.1123304116325227195797533167182832111272986902383876280357481893374380043283848201429836361152904889e-5592)) }},
{{ SC_(0.113778432933031581342220306396484375e-4), SC_(0.03654421865940093994140625), SC_(0.9688708782196044921875), SC_(0.5825356514402150924555439351704966386176716144780670249830283141506929468296452211723778443894234951e-1195), SC_(BOOST_MATH_SMALL_CONSTANT(0.1299246431009640780314778465681510321819328250560790012308930348335051591055920757982605267188242976e-132423)) }},
Modified: branches/release/libs/math/test/ibeta_inva_data.ipp
==============================================================================
--- branches/release/libs/math/test/ibeta_inva_data.ipp (original)
+++ branches/release/libs/math/test/ibeta_inva_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 7>, 1100> ibeta_inva_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 7>, 1100> ibeta_inva_data = { {
{{ SC_(0.101913392427377402782440185546875e-4), SC_(0.3082362115383148193359375), SC_(0.1355634629726409912109375), SC_(0.6498233713152427462579302903941895526823485861809005407005756658138299437345439685916818979079350952e-4), SC_(0.1598220360006443400909761969445329244603859759388130816641624923434214075962489978723834186220509792e-5), SC_(0.1598250823507423266003361933591577902014719110010440833489018043541995851576985396009647692344594598e-5), SC_(0.6499023539055942142435327607856798948132754954188633069136984730655318067141056849740949064680308213e-4) }},
{{ SC_(0.1127331415773369371891021728515625e-4), SC_(0.8350250720977783203125), SC_(0.221111953258514404296875), SC_(0.3971461302443922423613753292972913694448775540766244520233346130148330830638824141461619735572445997e-4), SC_(0.3200361118082439458200937030865347915510238320387461167764804252841304593011303390960681217527273982e-5), SC_(0.3200210889570744035937464686925692217326089474042347373846591880760057034684133216576634448402269381e-5), SC_(0.3970804661143976120973144952058224085647966940391220340079248912116191892887943249201895859632245494e-4) }},
{{ SC_(0.113778432933031581342220306396484375e-4), SC_(0.905801355838775634765625), SC_(0.913384497165679931640625), SC_(0.1078981970343159393325856300516135956140969598440175633458632674725240047510167692675710778553847126e-5), SC_(0.0001200181935703441995121934466228033111754654801609287621930678605774967528649020200620769888673021826), SC_(0.0001199468547533371496891932800417754246696194915133685876058567801242730706768275318621189458708399548), SC_(0.1078921129179782267266584693661729948023960221141040813461658037144034851960955828005953048025067861e-5) }},
Modified: branches/release/libs/math/test/ibeta_large_data.ipp
==============================================================================
--- branches/release/libs/math/test/ibeta_large_data.ipp (original)
+++ branches/release/libs/math/test/ibeta_large_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 7>, 1210> ibeta_large_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 7>, 1210> ibeta_large_data = { {
{{ SC_(0.104760829344741068780422210693359375e-4), SC_(39078.1875), SC_(0.913384497165679931640625), SC_(95444.37547576888548779405522478045372688), SC_(BOOST_MATH_SMALL_CONSTANT(0.4076397251031275963346153642645211144346e-41521)), SC_(1), SC_(BOOST_MATH_SMALL_CONSTANT(0.4270966445860582673748568606264586002504e-41526)) }},
{{ SC_(0.1127331415773369371891021728515625e-4), SC_(0.0226620174944400787353515625), SC_(0.1355634629726409912109375), SC_(88703.20318198098901713372585734808194292), SC_(45.9460483635769831377505786833842050448), SC_(0.9994822930837981780736860587426162687504), SC_(0.0005177069162018219263139412573837312496096) }},
{{ SC_(0.113778432933031581342220306396484375e-4), SC_(0.03654421865940093994140625), SC_(0.9688708782196044921875), SC_(87893.29210911967129223056449206866305889), SC_(24.13233514927218107101077084629346084654), SC_(0.999725511349976252733137998478545702411), SC_(0.0002744886500237472668620015214542975889712) }},
Modified: branches/release/libs/math/test/ibeta_small_data.ipp
==============================================================================
--- branches/release/libs/math/test/ibeta_small_data.ipp (original)
+++ branches/release/libs/math/test/ibeta_small_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 7>, 500> ibeta_small_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 7>, 500> ibeta_small_data = { {
{{ SC_(0.011510574258863925933837890625), SC_(2.726669788360595703125), SC_(0.913345992565155029296875), SC_(85.50804647765112454526520766832090120908), SC_(0.0004969774007283958673037601318581948437309), SC_(0.9999941879795790272650838125485136788379), SC_(0.5812020420972734916187451486321162137375e-5) }},
{{ SC_(0.0463422574102878570556640625), SC_(0.34317314624786376953125), SC_(0.24176712334156036376953125), SC_(20.36367089471426800179696837574809289039), SC_(3.630773740238788693031723031598949317136), SC_(0.8486827348798151491124959025982318049325), SC_(0.1513172651201848508875040974017681950675) }},
{{ SC_(0.06715317070484161376953125), SC_(2.30631923675537109375), SC_(0.908442795276641845703125), SC_(13.78727207173260438424514878253152024011), SC_(0.001859217475218142037637565734833320618317), SC_(0.9998651679038930266805148691555636600556), SC_(0.0001348320961069733194851308444363399443688) }},
Modified: branches/release/libs/math/test/igamma_big_data.ipp
==============================================================================
--- branches/release/libs/math/test/igamma_big_data.ipp (original)
+++ branches/release/libs/math/test/igamma_big_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 6>, 287> igamma_big_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 6>, 287> igamma_big_data = { {
{{ SC_(0.1730655412757187150418758392333984375e-5), SC_(0.1730655441178896580822765827178955078125e-7), SC_(-1), SC_(0.2993117912029903240422582053899047098779533956541385552546168739467202263345519375546082579259835689e-4), SC_(577797.90391619920649973095027584836128926282155274216943338008435801586707772349755359609709258809), SC_(0.9999700688208797009675957741794610095290122046604345861444745383126053279773665448062442806862583006) }},
{{ SC_(0.1730655412757187150418758392333984375e-5), SC_(0.8653277063785935752093791961669921875e-6), SC_(13.38277582367555562294055416847373915500263659346494217875993623821221196887112446988546507684731302), SC_(0.2316099655383339755405731669847576162961123204586203558223557251327214945205980959748823352959805302e-4), SC_(577801.8158305834504756449335090514614341009677858339594077124115869397920785194231187741120056354752), SC_(0.9999768390034461666024459426833015242383703887679541379644177644274867278505479401904023114002150846) }},
{{ SC_(0.1730655412757187150418758392333984375e-5), SC_(0.15575898260067333467304706573486328125e-5), SC_(12.79500378214091254793715786456975103024623413471734292810881005720669047076428987935745392946724363), SC_(0.2214376467251173939070843604623148303831679646741287024258011317172427658231597089388494422353631048e-4), SC_(577802.4036026249851187199369053553654222257241882927070069630627131207976000175299533646400167828553), SC_(0.9999778562353274882606092915639537685169616832035325871297574198868282757234176840291059234224082336) }},
Modified: branches/release/libs/math/test/igamma_int_data.ipp
==============================================================================
--- branches/release/libs/math/test/igamma_int_data.ipp (original)
+++ branches/release/libs/math/test/igamma_int_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 6>, 140> igamma_int_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 6>, 140> igamma_int_data = { {
{{ SC_(0.5), SC_(0.004999999888241291046142578125), SC_(1.631267845368323485191815380032984903074365412587098308286220239190324188420710121791871591309590004), SC_(0.9203443263332001265162236927545643793578786527087679769237787431564844748135321134774112708209554194), SC_(0.1411860055371925421063521033081602797231840435352888199275875506625870961703220596656577919527041757), SC_(0.07965567366679987348377630724543562064212134729123202307622125684351552518646788652258872917904458057) }},
{{ SC_(0.5), SC_(0.25), SC_(0.8498918380799311297867616098602389766300312781938048348528626579829435160004444680322048858624092311), SC_(0.479500122186953462317253346108035471263548424242036299941194274352806478283146429109461900411394659), SC_(0.9225620128255848975114058734809062061675181779285822933609451318699677685905877134253244973998849491), SC_(0.520499877813046537682746653891964528736451575757963700058805725647193521716853570890538099588605341) }},
{{ SC_(0.5), SC_(0.449999988079071044921875), SC_(0.6075647752751784703583581789426278456752564880945645704809989500539948786183333019925969429005007538), SC_(0.3427817175407890768272360273834711985342418909050114189064883223090985450970247707985828865357086527), SC_(1.164889075630337556939809304398517337122292968027822557732808839798916405972698879464932440361793426), SC_(0.6572182824592109231727639726165288014657581090949885810935116776909014549029752292014171134642913473) }},
Modified: branches/release/libs/math/test/igamma_med_data.ipp
==============================================================================
--- branches/release/libs/math/test/igamma_med_data.ipp (original)
+++ branches/release/libs/math/test/igamma_med_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 6>, 700> igamma_med_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 6>, 700> igamma_med_data = { {
{{ SC_(0.9759566783905029296875), SC_(0.009759566746652126312255859375), SC_(1.003339192007827076679495082852814844336347745360235976200689788561799007730110137330271807878843422), SC_(0.9890348932311204142405476428315735322132825375129739181325170152149560168983641202727073881868421137), SC_(0.01112369385656880593053787042266942213006008594885039559843996330162391632861423778173725952365124566), SC_(0.01096510676887958575945235716842646778671746248702608186748298478504398310163587972729261181315788632) }},
{{ SC_(0.9759566783905029296875), SC_(0.48797833919525146484375), SC_(0.6107075742899761923771199703161020169732161418698525715736270035568544567698769445946517198087313906), SC_(0.60200090392622800556746880021527940973985765617427715855663599678855269649431562996389062378697249), SC_(0.4037553115744196902329129829593822494931916894392338002255027483065684672888474305173573475937632775), SC_(0.39799909607377199443253119978472059026014234382572284144336400321144730350568437003610937621302751) }},
{{ SC_(0.9759566783905029296875), SC_(0.8783609867095947265625), SC_(0.4103188243195825736649265764483608742565650301514019080978258727846258380934756822777647401521337079), SC_(0.4044690348331089562847173039266064850324957624072768224521011340506874965505832795400716939018472498), SC_(0.6041440615448133089451063768271233922098428011576844637013038790787970859652486928342443272503609601), SC_(0.5955309651668910437152826960733935149675042375927231775478988659493125034494167204599283060981527502) }},
Modified: branches/release/libs/math/test/igamma_small_data.ipp
==============================================================================
--- branches/release/libs/math/test/igamma_small_data.ipp (original)
+++ branches/release/libs/math/test/igamma_small_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 6>, 252> igamma_small_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 6>, 252> igamma_small_data = { {
{{ SC_(0.165048161769598689119220580323599278926849365234375e-11), SC_(0.165048164480104120332981665342231281101703643798828125e-13), SC_(31.15790848492937617968754572910879626038987427321665501824062445965678033809696860327421033588997389), SC_(0.5142555520027874508595595722328287870710653491133268223717400674935981376413784737279829921742056631e-10), SC_(605883754914.8750136902267543620760601500284208480879474455026885251060577270869941538181411625849707), SC_(0.9999999999485744447997212549140440427767171212928934650886673177628259932506401862358621522444918976) }},
{{ SC_(0.165048161769598689119220580323599278926849365234375e-11), SC_(0.825240808847993445596102901617996394634246826171875e-12), SC_(27.24588549611682625963801859326817650865189920983978484217386169027034380426371292313397641222047523), SC_(0.4496883316923336685099678252541612612557662391990416220973173325702496188138998642060577791819560088e-10), SC_(605883754918.7870366790393042821255872858690405998259225088795587011728204964734306876513968427252046), SC_(0.9999999999550311668307666331490032174745838738744233760800958377902682667429750381186100131967398492) }},
{{ SC_(0.165048161769598689119220580323599278926849365234375e-11), SC_(0.1485433412558301302652807862614281475543975830078125e-11), SC_(26.65809886043765184861833815671322602877461879268583897860494287446522932950747972178867249013415618), SC_(0.4399870213191659715445515622143744278264487110204265430288897607131180016977120873571283497579633446e-10), SC_(605883754919.3748233147184786931452677224239910797032029260335045647417393122785451624076300440705085), SC_(0.9999999999560012978680834028455448437785625572173551288979573456971110239286881998302287908816411206) }},
Modified: branches/release/libs/math/test/laguerre2.ipp
==============================================================================
--- branches/release/libs/math/test/laguerre2.ipp (original)
+++ branches/release/libs/math/test/laguerre2.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 280> laguerre2 = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 280> laguerre2 = {{
{{ SC_(0.5e1), SC_(0.9754039764404296875e2), SC_(-0.56218428868911115998451316426215010600803852349048e8) }},
{{ SC_(0.5e1), SC_(0.12698681640625e3), SC_(-0.2243354877625806499089339248835065869040287604245e9) }},
{{ SC_(0.5e1), SC_(0.1354770050048828125e3), SC_(-0.31418973293934559300911242611564538290439848722478e9) }},
Modified: branches/release/libs/math/test/laguerre3.ipp
==============================================================================
--- branches/release/libs/math/test/laguerre3.ipp (original)
+++ branches/release/libs/math/test/laguerre3.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 2240> laguerre3 = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 2240> laguerre3 = {{
{{ SC_(0.6e1), SC_(0.4e1), SC_(0.9754039764404296875e2), SC_(0.61248773400035441372705568899743424188675775638604e9) }},
{{ SC_(0.6e1), SC_(0.4e1), SC_(0.12698681640625e3), SC_(0.35204789737752362425049635886299775785128782532338e10) }},
{{ SC_(0.6e1), SC_(0.4e1), SC_(0.1354770050048828125e3), SC_(0.53680020529340456542399945558001901900007952546989e10) }},
Modified: branches/release/libs/math/test/legendre_p.ipp
==============================================================================
--- branches/release/libs/math/test/legendre_p.ipp (original)
+++ branches/release/libs/math/test/legendre_p.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 140> legendre_p = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 140> legendre_p = {{
{{ SC_(3), SC_(-0.804919183254241943359375), SC_(-0.09637879251279735399302410605920296560178428535437), SC_(-0.84585603807674271376114723023136351467791030262194) }},
{{ SC_(3), SC_(-0.74602639675140380859375), SC_(0.081027074619746344180737168075984167003866787126753), SC_(-0.80282652754865351221792807765781454966620965987346) }},
{{ SC_(3), SC_(-0.72904598712921142578125), SC_(0.12483445078630286253952851342405305778981983166886), SC_(-0.77778604740049228448138273219369426999256253154477) }},
Modified: branches/release/libs/math/test/legendre_p_large.ipp
==============================================================================
--- branches/release/libs/math/test/legendre_p_large.ipp (original)
+++ branches/release/libs/math/test/legendre_p_large.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 160> legendre_p_large = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 160> legendre_p_large = {{
{{ SC_(29), SC_(-0.74602639675140380859375), SC_(0.050915219643735786802064817454102557266509665552523), SC_(-0.27118035040452065163236941090242943684321195237749) }},
{{ SC_(29), SC_(-0.72904598712921142578125), SC_(0.15209960929167220423613043592541930303920942697128), SC_(-0.1438359066051312703697159687668902900032679225431) }},
{{ SC_(29), SC_(-0.5579319000244140625), SC_(0.15849246733249484229246386045081847903407720368835), SC_(-0.046562152771403674797644638451970346262085750814402) }},
Modified: branches/release/libs/math/test/log1p_expm1_data.ipp
==============================================================================
--- branches/release/libs/math/test/log1p_expm1_data.ipp (original)
+++ branches/release/libs/math/test/log1p_expm1_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,9 +3,9 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
- static const boost::array<boost::array<T, 3>, 80> log1p_expm1_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 80> log1p_expm1_data = { {
{{ SC_(-0.69330310821533203125e0), SC_(-0.1181895342296499380302723361817935835636e1), SC_(-0.5000779577496508480606742934033661111325e0) }},
{{ SC_(-0.650003612041473388671875e0), SC_(-0.1049832444670425873798449427248829256278e1), SC_(-0.477956108886575099597621504254337139212e0) }},
{{ SC_(-0.5634434223175048828125e0), SC_(-0.8288372954181591063099417140530721209296e0), SC_(-0.4307544676154126107123951950891833745657e0) }},
Modified: branches/release/libs/math/test/log1p_expm1_test.hpp
==============================================================================
--- branches/release/libs/math/test/log1p_expm1_test.hpp (original)
+++ branches/release/libs/math/test/log1p_expm1_test.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -8,13 +8,14 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
-template <class T>
+template <class Real, class T>
void do_test(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -34,10 +35,10 @@
#else
funcp = &boost::math::log1p;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::log1p", "log1p and expm1");
std::cout << std::endl;
//
@@ -48,10 +49,10 @@
#else
funcp = boost::math::expm1;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(2));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::expm1", "log1p and expm1");
std::cout << std::endl;
}
@@ -61,7 +62,7 @@
{
# include "log1p_expm1_data.ipp"
- do_test(log1p_expm1_data, type_name, "expm1 and log1p");
+ do_test<T>(log1p_expm1_data, type_name, "expm1 and log1p");
//
// C99 Appendix F special cases:
Modified: branches/release/libs/math/test/ncbeta.ipp
==============================================================================
--- branches/release/libs/math/test/ncbeta.ipp (original)
+++ branches/release/libs/math/test/ncbeta.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,8 +3,8 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 6>, 3000> ncbeta = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 6>, 3000> ncbeta = {{
{{ SC_(1.454305052757263183593750000000000000000), SC_(1.454305052757263183593750000000000000000e-1), SC_(5.940588760375976562500000000000000000000e1), SC_(9.976066350936889648437500000000000000000e-1), SC_(2.759834870217354705236013708534509068967e-1), SC_(7.240165129782645294763986291465490931033e-1) }},
{{ SC_(1.454305052757263183593750000000000000000), SC_(1.454305052757263183593750000000000000000e-1), SC_(1.451677856445312500000000000000000000000e2), SC_(9.990068674087524414062500000000000000000e-1), SC_(2.757975665000284929998400439182434398680e-1), SC_(7.242024334999715070001599560817565601320e-1) }},
{{ SC_(1.454305052757263183593750000000000000000), SC_(1.454305052757263183593750000000000000000e-1), SC_(1.929777069091796875000000000000000000000e2), SC_(9.992512464523315429687500000000000000000e-1), SC_(2.757802819095769722518059796277858159202e-1), SC_(7.242197180904230277481940203722141840798e-1) }},
Modified: branches/release/libs/math/test/ncbeta_big.ipp
==============================================================================
--- branches/release/libs/math/test/ncbeta_big.ipp (original)
+++ branches/release/libs/math/test/ncbeta_big.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,8 +3,8 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 6>, 72> ncbeta_big = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 6>, 72> ncbeta_big = {{
{{ SC_(2.322846374511718750000000000000000000000e2), SC_(2.090561676025390625000000000000000000000e2), SC_(2.322846374511718750000000000000000000000e2), SC_(6.248598918318748474121093750000000000000e-2), SC_(5.822794103663371475941613559141512048716e-200), SC_(1.000000000000000000000000000000000000000) }},
{{ SC_(2.322846374511718750000000000000000000000e2), SC_(2.299617919921875000000000000000000000000e2), SC_(2.906821289062500000000000000000000000000e2), SC_(1.553418934345245361328125000000000000000e-1), SC_(2.376427035888773394585864365564861664654e-112), SC_(1.000000000000000000000000000000000000000) }},
{{ SC_(2.322846374511718750000000000000000000000e2), SC_(2.320523529052734375000000000000000000000e2), SC_(9.757655029296875000000000000000000000000e2), SC_(3.780863285064697265625000000000000000000e-1), SC_(9.534309971409020993977308030456117404144e-89), SC_(1.000000000000000000000000000000000000000) }},
Modified: branches/release/libs/math/test/nccs.ipp
==============================================================================
--- branches/release/libs/math/test/nccs.ipp (original)
+++ branches/release/libs/math/test/nccs.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,8 +3,8 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 5>, 3200> nccs = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 5>, 3200> nccs = {{
{{ SC_(1.951913356781005859375000000000000000000), SC_(9.566968083381652832031250000000000000000e-1), SC_(2.908610105514526367187500000000000000000e-1), SC_(9.191713210042786241188236234883914114395e-2), SC_(9.080828678995721375881176376511608588560e-1) }},
{{ SC_(1.951913356781005859375000000000000000000), SC_(6.366568565368652343750000000000000000000), SC_(2.079620361328125000000000000000000000000), SC_(8.979177306921986952474050864260945461537e-2), SC_(9.102082269307801304752594913573905453846e-1) }},
{{ SC_(1.951913356781005859375000000000000000000), SC_(6.889215946197509765625000000000000000000), SC_(4.420564651489257812500000000000000000000), SC_(2.322522640917811378036214577533389504074e-1), SC_(7.677477359082188621963785422466610495926e-1) }},
Modified: branches/release/libs/math/test/nccs_big.ipp
==============================================================================
--- branches/release/libs/math/test/nccs_big.ipp (original)
+++ branches/release/libs/math/test/nccs_big.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -8,8 +8,8 @@
// the current algorithm may underflow to zero
// prematurely in these cases.
//
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 5>, 216> nccs_big = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 5>, 216> nccs_big = {{
{{ SC_(1.018147201538085937500000000000000000000e2), SC_(1.814723730087280273437500000000000000000), SC_(1.036294460296630859375000000000000000000e1), SC_(6.015496565199092654771842521716269252752e-33), SC_(9.999999999999999999999999999999939845034e-1) }},
{{ SC_(1.018147201538085937500000000000000000000e2), SC_(2.270954132080078125000000000000000000000), SC_(2.602141952514648437500000000000000000000e1), SC_(6.271325708033427466636203558887430713942e-16), SC_(9.999999999999993728674291966572533363796e-1) }},
{{ SC_(1.018147201538085937500000000000000000000e2), SC_(7.623167991638183593750000000000000000000), SC_(5.471894454956054687500000000000000000000e1), SC_(5.592130493491734836774684682197361443348e-6), SC_(9.999944078695065082651632253153178026386e-1) }},
Modified: branches/release/libs/math/test/nct.ipp
==============================================================================
--- branches/release/libs/math/test/nct.ipp (original)
+++ branches/release/libs/math/test/nct.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -4,9 +4,10 @@
// Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 5>, 209-7> nct = {{
+#ifndef SC_
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+#endif
+ static const boost::array<boost::array<typename table_type<T>::type, 5>, 209-7> nct = {{
{{ SC_(5.637862086296081542968750000000000000000e-1), SC_(-5.074075460433959960937500000000000000000e-1), SC_(-3.162277862429618835449218750000000000000e-2), SC_(6.862274577179818450132372470056769938949e-1), SC_(3.137725422820181549867627529943230061051e-1) }},
{{ SC_(9.567963480949401855468750000000000000000e-1), SC_(-9.472283720970153808593750000000000000000e-1), SC_(-7.905694097280502319335937500000000000000e-2), SC_(8.115615601997266002916301508229723403909e-1), SC_(1.884384398002733997083698491770276596091e-1) }},
{{ SC_(2.380512714385986328125000000000000000000), SC_(-2.378132343292236328125000000000000000000), SC_(-6.344355583190917968750000000000000000000), SC_(1.181983559218041139443788725932712768639e-1), SC_(8.818016440781958860556211274067287231361e-1) }},
Modified: branches/release/libs/math/test/negative_binomial_quantile.ipp
==============================================================================
--- branches/release/libs/math/test/negative_binomial_quantile.ipp (original)
+++ branches/release/libs/math/test/negative_binomial_quantile.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,8 +3,8 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 5>, 792> negative_binomial_quantile_data = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 5>, 792> negative_binomial_quantile_data = {{
{{ SC_(4.285762786865234375), SC_(0.12698681652545928955078125), SC_(0.097540400922298431396484375), SC_(11.568381290037563253305975817351444024377036234904), SC_(49.67581419477884086070549390307050513757197652133) }},
{{ SC_(4.285762786865234375), SC_(0.12698681652545928955078125), SC_(0.12698681652545928955078125), SC_(12.977136041273636067294825573363051160267257422387), SC_(46.43808301937089644496373095130068129633820080023) }},
{{ SC_(4.285762786865234375), SC_(0.12698681652545928955078125), SC_(0.135477006435394287109375), SC_(13.355446548799362499196093574014767375702882517351), SC_(45.626103029359612367556766004407934151298781150048) }},
Modified: branches/release/libs/math/test/pch.hpp
==============================================================================
--- branches/release/libs/math/test/pch.hpp (original)
+++ branches/release/libs/math/test/pch.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -5,14 +5,11 @@
#ifdef BOOST_BUILD_PCH_ENABLED
-#define ONE <boost/math/special_functions.hpp>
-#define TWO <boost/math/distributions.hpp>
-
#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
#include <boost/test/test_exec_monitor.hpp>
#include <boost/test/floating_point_comparison.hpp>
-#include ONE
-#include TWO
+#include <boost/math/special_functions.hpp>
+#include <boost/math/distributions.hpp>
#include <boost/math/tools/test.hpp>
#include <boost/math/tools/stats.hpp>
#include <boost/type_traits.hpp>
Modified: branches/release/libs/math/test/poisson_quantile.ipp
==============================================================================
--- branches/release/libs/math/test/poisson_quantile.ipp (original)
+++ branches/release/libs/math/test/poisson_quantile.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,8 +3,8 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 4>, 619> poisson_quantile_data = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 619> poisson_quantile_data = {{
{{ SC_(2.539736270904541015625), SC_(0.097540400922298431396484375), SC_(0.1236392659323415267286721455855935332272165776019), SC_(4.1794244675777288954971650240102219690023733491107) }},
{{ SC_(2.539736270904541015625), SC_(0.12698681652545928955078125), SC_(0.29692152360861802647109703200927257466043783201072), SC_(3.8759279753758017243263560996428606489658831749751) }},
{{ SC_(2.539736270904541015625), SC_(0.135477006435394287109375), SC_(0.34320650665410472759846385302850183249926507900385), SC_(3.7989374337321363992500232228194835442428384328783) }},
Modified: branches/release/libs/math/test/pow_test.cpp
==============================================================================
--- branches/release/libs/math/test/pow_test.cpp (original)
+++ branches/release/libs/math/test/pow_test.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -41,7 +41,7 @@
{
BOOST_CHECK_CLOSE(math::pow<N>(base),
pow(static_cast<result_type>(base), static_cast<result_type>(N)),
- boost::math::tools::epsilon<result_type>() * 100 * 200); // 200 eps as a %
+ boost::math::tools::epsilon<result_type>() * 100 * 400); // 400 eps as a %
}
}
@@ -182,14 +182,14 @@
test_with_big_exponents<long double, -1>();
cout << "Testing with concepts::real_concept precision bases and positive small exponents" << endl;
- test_with_small_exponents<concepts::real_concept, 1>();
+ test_with_small_exponents<boost::math::concepts::real_concept, 1>();
cout << "Testing with concepts::real_concept precision bases and negative small exponents" << endl;
- test_with_small_exponents<concepts::real_concept, -1>();
+ test_with_small_exponents<boost::math::concepts::real_concept, -1>();
cout << "Testing with concepts::real_concept precision bases and positive big exponents" << endl;
- test_with_big_exponents<concepts::real_concept, 1>();
+ test_with_big_exponents<boost::math::concepts::real_concept, 1>();
cout << "Testing with concepts::real_concept precision bases and negative big exponents" << endl;
- test_with_big_exponents<concepts::real_concept, -1>();
+ test_with_big_exponents<boost::math::concepts::real_concept, -1>();
#endif
test_return_types();
Modified: branches/release/libs/math/test/powm1_sqrtp1m1_test.hpp
==============================================================================
--- branches/release/libs/math/test/powm1_sqrtp1m1_test.hpp (original)
+++ branches/release/libs/math/test/powm1_sqrtp1m1_test.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -7,15 +7,16 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
template <class T>
void test_powm1_sqrtp1m1(T, const char* type_name)
{
- static const boost::array<boost::array<T, 2>, 141> sqrtp1m1_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 141> sqrtp1m1_data = {{
{{ SC_(-0.990433037281036376953125), SC_(-0.902189148255607021082179865003660033379) }},
{{ SC_(-0.928576648235321044921875), SC_(-0.7327485233629588435419837213946140663952) }},
{{ SC_(-0.804919183254241943359375), SC_(-0.5583204592175928547330219789723812512248) }},
@@ -159,7 +160,7 @@
{{ SC_(0.99292266368865966796875), SC_(0.4117091285702801135545007937655927942821) }},
}};
- static const boost::array<boost::array<T, 3>, 1400> powm1_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 1400> powm1_data = {{
{{ SC_(0.161179845478123719842988847972264920827e-14), SC_(0.1431564604442703013402649929484277542953e-29), SC_(-0.4876113153308343652049349438365788782568e-28) }},
{{ SC_(0.161179845478123719842988847972264920827e-14), SC_(0.1791466932348087634896446282571611213266e-29), SC_(-0.6101991796549119337733033929476086235147e-28) }},
{{ SC_(0.161179845478123719842988847972264920827e-14), SC_(0.6013619202535540063110633226832922483532e-29), SC_(-0.2048324441766037485142714404837079817647e-27) }},
@@ -1569,10 +1570,10 @@
typedef T (*func_t)(const T&);
func_t f = &boost::math::sqrt1pm1<T>;
- boost::math::tools::test_result<T> result = boost::math::tools::test(
+ boost::math::tools::test_result<T> result = boost::math::tools::test_hetero<T>(
sqrtp1m1_data,
- bind_func(f, 0),
- extract_result(1));
+ bind_func<T>(f, 0),
+ extract_result<T>(1));
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
"Test results for type " << type_name << std::endl << std::endl;
@@ -1580,10 +1581,10 @@
typedef T (*func2_t)(T const, T const);
func2_t f2 = &boost::math::powm1<T,T>;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<T>(
powm1_data,
- bind_func(f2, 0, 1),
- extract_result(2));
+ bind_func<T>(f2, 0, 1),
+ extract_result<T>(2));
handle_test_result(result, powm1_data[result.worst()], result.worst(), type_name, "boost::math::powm1", "powm1");
}
Modified: branches/release/libs/math/test/sph_bessel_data.ipp
==============================================================================
--- branches/release/libs/math/test/sph_bessel_data.ipp (original)
+++ branches/release/libs/math/test/sph_bessel_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 483> sph_bessel_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 483> sph_bessel_data = {{
{{ SC_(0), SC_(0.177219114266335964202880859375e-2), SC_(0.999999476556507842202459130864323898236e0) }},
{{ SC_(0), SC_(0.22177286446094512939453125e-2), SC_(0.9999991802801447287222232346958222796612e0) }},
{{ SC_(0), SC_(0.7444499991834163665771484375e-2), SC_(0.9999907632622405689302860688925139982587e0) }},
Modified: branches/release/libs/math/test/sph_neumann_data.ipp
==============================================================================
--- branches/release/libs/math/test/sph_neumann_data.ipp (original)
+++ branches/release/libs/math/test/sph_neumann_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 284> sph_neumann_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 284> sph_neumann_data = {{
{{ SC_(0), SC_(0.177219114266335964202880859375e-2), SC_(-0.5642723324792311990959765396871018960216e3) }},
{{ SC_(0), SC_(0.22177286446094512939453125e-2), SC_(-0.4509106843488238999473616173421364998283e3) }},
{{ SC_(0), SC_(0.7444499991834163665771484375e-2), SC_(-0.1343236336805396008478682587573788632696e3) }},
Modified: branches/release/libs/math/test/spherical_harmonic.ipp
==============================================================================
--- branches/release/libs/math/test/spherical_harmonic.ipp (original)
+++ branches/release/libs/math/test/spherical_harmonic.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,8 +3,8 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 6>, 1000> spherical_harmonic = {{
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 6>, 1000> spherical_harmonic = {{
{{ SC_(0.2e1), SC_(0), SC_(-0.6223074436187744140625e1), SC_(-0.983176708221435546875e0), SC_(0.62736841735769885881246893757736785347239567286304e0), SC_(0) }},
{{ SC_(0.2e1), SC_(0), SC_(-0.5057456493377685546875e1), SC_(0.59339153766632080078125e0), SC_(-0.20713028443163886820218719974386053923059852163073e0), SC_(0) }},
{{ SC_(0.2e1), SC_(0), SC_(-0.4687422275543212890625e1), SC_(0.5891966342926025390625e1), SC_(-0.31480190270523966739513025513763623833894947272512e0), SC_(0) }},
Modified: branches/release/libs/math/test/test_bessel_i.cpp
==============================================================================
--- branches/release/libs/math/test/test_bessel_i.cpp (original)
+++ branches/release/libs/math/test/test_bessel_i.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -75,6 +75,13 @@
".*", 400, 200); // test function
add_expected_result(
+ "GNU.*", // compiler
+ ".*", // stdlib
+ "Win32.*", // platform
+ largest_type, // test type(s)
+ ".*", // test data group
+ ".*", 30, 10); // test function
+ add_expected_result(
".*", // compiler
".*", // stdlib
".*", // platform
Modified: branches/release/libs/math/test/test_bessel_i.hpp
==============================================================================
--- branches/release/libs/math/test/test_bessel_i.hpp (original)
+++ branches/release/libs/math/test/test_bessel_i.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -14,9 +14,10 @@
#include "handle_test_result.hpp"
#include "test_bessel_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+# define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
template <class T>
@@ -27,11 +28,11 @@
boost::math::itrunc(v), x));
}
-template <class T>
+template <class Real, class T>
void do_test_cyl_bessel_i(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -48,10 +49,10 @@
//
// test cyl_bessel_i against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_bessel_i", test_name);
std::cout << std::endl;
@@ -75,11 +76,11 @@
#endif
}
-template <class T>
+template <class Real, class T>
void do_test_cyl_bessel_i_int(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -96,10 +97,10 @@
//
// test cyl_bessel_i against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_bessel_i", test_name);
std::cout << std::endl;
}
@@ -114,8 +115,8 @@
{{ SC_(0), SC_(-2), SC_(2.27958530233606726743720444081153335328584110278545905407084) }},
{{ SC_(0), SC_(4), SC_(11.3019219521363304963562701832171024974126165944353377060065) }},
{{ SC_(0), SC_(-7), SC_(168.593908510289698857326627187500840376522679234531714193194) }},
- {{ SC_(0), SC_(1) / 1024, SC_(1.00000023841859331241759166109699567801556273303717896447683) }},
- {{ SC_(0), SC_(1) / (1024*1024), SC_(1.00000000000022737367544324498417583090700894607432256476338) }},
+ {{ SC_(0), T(1) / 1024, SC_(1.00000023841859331241759166109699567801556273303717896447683) }},
+ {{ SC_(0), T(SC_(1)) / (1024*1024), SC_(1.00000000000022737367544324498417583090700894607432256476338) }},
{{ SC_(0), SC_(-1), SC_(1.26606587775200833559824462521471753760767031135496220680814) }},
{{ SC_(0), SC_(100), SC_(1.07375170713107382351972085760349466128840319332527279540154e42) }},
{{ SC_(0), SC_(200), SC_(2.03968717340972461954167312677945962233267573614834337894328e85) }},
@@ -126,15 +127,15 @@
{{ SC_(1), SC_(-2), SC_(-1.59063685463732906338225442499966624795447815949553664713229) }},
{{ SC_(1), SC_(4), SC_(9.75946515370444990947519256731268090005597033325296730692753) }},
{{ SC_(1), SC_(-8), SC_(-399.873136782560098219083086145822754889628443904067647306574) }},
- {{ SC_(1), SC_(1)/1024, SC_(0.000488281308207663226432087816784315537514225208473395063575150) }},
- {{ SC_(1), SC_(1)/(1024*1024), SC_(4.76837158203179210108624277276025646653133998635956784292029E-7) }},
+ {{ SC_(1), T(SC_(1))/1024, SC_(0.000488281308207663226432087816784315537514225208473395063575150) }},
+ {{ SC_(1), T(SC_(1))/(1024*1024), SC_(4.76837158203179210108624277276025646653133998635956784292029E-7) }},
{{ SC_(1), SC_(-10), SC_(-2670.98830370125465434103196677215254914574515378753771310849) }},
{{ SC_(1), SC_(100), SC_(1.06836939033816248120614576322429526544612284405623226965918e42) }},
{{ SC_(1), SC_(200), SC_(2.03458154933206270342742797713906950389661161681122964159220e85) }},
}};
static const boost::array<boost::array<T, 3>, 11> in_data = {{
{{ SC_(-2), SC_(0), SC_(0) }},
- {{ SC_(2), SC_(1)/(1024*1024), SC_(1.13686837721624646204093977095674566928522671779753217215467e-13) }},
+ {{ SC_(2), T(SC_(1))/(1024*1024), SC_(1.13686837721624646204093977095674566928522671779753217215467e-13) }},
{{ SC_(5), SC_(10), SC_(777.188286403259959907293484802339632852674154572666041953297) }},
{{ SC_(-5), SC_(100), SC_(9.47009387303558124618275555002161742321578485033007130107740e41) }},
{{ SC_(-5), SC_(-1), SC_(-0.000271463155956971875181073905153777342383564426758143634974124) }},
@@ -146,16 +147,16 @@
{{ SC_(10), SC_(1e-100), SC_(2.69114445546737213403880070546737213403880070546737213403880e-1010) }},
}};
static const boost::array<boost::array<T, 3>, 10> iv_data = {{
- {{ SC_(2.25), SC_(1)/(1024*1024), SC_(2.34379212133481347189068464680335815256364262507955635911656e-15) }},
+ {{ SC_(2.25), T(1)/(1024*1024), SC_(2.34379212133481347189068464680335815256364262507955635911656e-15) }},
{{ SC_(5.5), SC_(3.125), SC_(0.0583514045989371500460946536220735787163510569634133670181210) }},
- {{ SC_(-5) + T(1)/1024, SC_(2.125), SC_(0.0267920938009571023702933210070984416052633027166975342895062) }},
+ {{ T(-5) + T(1)/1024, SC_(2.125), SC_(0.0267920938009571023702933210070984416052633027166975342895062) }},
{{ SC_(-5.5), SC_(10), SC_(597.577606961369169607937419869926705730305175364662688426534) }},
{{ SC_(-5.5), SC_(100), SC_(9.22362906144706871737354069133813819358704200689067071415379e41) }},
- {{ SC_(-10486074)/(1024*1024), SC_(1)/1024, SC_(1.41474005665181350367684623930576333542989766867888186478185e35) }},
- {{ SC_(-10486074)/(1024*1024), SC_(50), SC_(1.07153277202900671531087024688681954238311679648319534644743e20) }},
- {{ SC_(144794)/1024, SC_(100), SC_(2066.27694757392660413922181531984160871678224178890247540320) }},
- {{ SC_(144794)/1024, SC_(200), SC_(2.23699739472246928794922868978337381373643889659337595319774e64) }},
- {{ SC_(-144794)/1024, SC_(100), SC_(2066.27694672763190927440969155740243346136463461655104698748) }},
+ {{ T(-10486074)/(1024*1024), T(1)/1024, SC_(1.41474005665181350367684623930576333542989766867888186478185e35) }},
+ {{ T(-10486074)/(1024*1024), SC_(50), SC_(1.07153277202900671531087024688681954238311679648319534644743e20) }},
+ {{ T(144794)/1024, SC_(100), SC_(2066.27694757392660413922181531984160871678224178890247540320) }},
+ {{ T(144794)/1024, SC_(200), SC_(2.23699739472246928794922868978337381373643889659337595319774e64) }},
+ {{ T(-144794)/1024, SC_(100), SC_(2066.27694672763190927440969155740243346136463461655104698748) }},
}};
static const boost::array<boost::array<T, 3>, 5> iv_large_data = {{
// Bug report https://svn.boost.org/trac/boost/ticket/5560:
@@ -166,22 +167,22 @@
{{ SC_(0.5), static_cast<T>(ldexp(0.5, -683)), SC_(8.90597649117647254543282704099383321071493400182381039079219e-104) }},
}};
- do_test_cyl_bessel_i(i0_data, name, "Bessel I0: Mathworld Data");
- do_test_cyl_bessel_i(i1_data, name, "Bessel I1: Mathworld Data");
- do_test_cyl_bessel_i(in_data, name, "Bessel In: Mathworld Data");
-
- do_test_cyl_bessel_i_int(i0_data, name, "Bessel I0: Mathworld Data (Integer Version)");
- do_test_cyl_bessel_i_int(i1_data, name, "Bessel I1: Mathworld Data (Integer Version)");
- do_test_cyl_bessel_i_int(in_data, name, "Bessel In: Mathworld Data (Integer Version)");
+ do_test_cyl_bessel_i<T>(i0_data, name, "Bessel I0: Mathworld Data");
+ do_test_cyl_bessel_i<T>(i1_data, name, "Bessel I1: Mathworld Data");
+ do_test_cyl_bessel_i<T>(in_data, name, "Bessel In: Mathworld Data");
+
+ do_test_cyl_bessel_i_int<T>(i0_data, name, "Bessel I0: Mathworld Data (Integer Version)");
+ do_test_cyl_bessel_i_int<T>(i1_data, name, "Bessel I1: Mathworld Data (Integer Version)");
+ do_test_cyl_bessel_i_int<T>(in_data, name, "Bessel In: Mathworld Data (Integer Version)");
- do_test_cyl_bessel_i(iv_data, name, "Bessel Iv: Mathworld Data");
+ do_test_cyl_bessel_i<T>(iv_data, name, "Bessel Iv: Mathworld Data");
#include "bessel_i_int_data.ipp"
- do_test_cyl_bessel_i(bessel_i_int_data, name, "Bessel In: Random Data");
+ do_test_cyl_bessel_i<T>(bessel_i_int_data, name, "Bessel In: Random Data");
#include "bessel_i_data.ipp"
- do_test_cyl_bessel_i(bessel_i_data, name, "Bessel Iv: Random Data");
+ do_test_cyl_bessel_i<T>(bessel_i_data, name, "Bessel Iv: Random Data");
if(0 != static_cast<T>(ldexp(0.5, -700)))
- do_test_cyl_bessel_i(iv_large_data, name, "Bessel Iv: Mathworld Data (large values)");
+ do_test_cyl_bessel_i<T>(iv_large_data, name, "Bessel Iv: Mathworld Data (large values)");
}
Modified: branches/release/libs/math/test/test_bessel_j.cpp
==============================================================================
--- branches/release/libs/math/test/test_bessel_j.cpp (original)
+++ branches/release/libs/math/test/test_bessel_j.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -271,6 +271,16 @@
".*", // test data group
".*", 40, 20); // test function
//
+ // One set of float tests has inexact input values, so there is a slight error:
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ "float", // test type(s)
+ "Bessel J: Mathworld Data", // test data group
+ ".*", 20, 20); // test function
+ //
// Finish off by printing out the compiler/stdlib/platform names,
// we do this to make it easier to mark up expected error rates.
//
Modified: branches/release/libs/math/test/test_bessel_j.hpp
==============================================================================
--- branches/release/libs/math/test/test_bessel_j.hpp (original)
+++ branches/release/libs/math/test/test_bessel_j.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -8,22 +8,24 @@
#include <boost/test/test_exec_monitor.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
+#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#include "functor.hpp"
#include "handle_test_result.hpp"
#include "test_bessel_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+# define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_cyl_bessel_j(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -40,10 +42,10 @@
//
// test cyl_bessel_j against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_bessel_j", test_name);
std::cout << std::endl;
@@ -55,10 +57,10 @@
//
// test other::cyl_bessel_j against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "other::cyl_bessel_j", test_name);
std::cout << std::endl;
}
@@ -72,11 +74,11 @@
}
-template <class T>
+template <class Real, class T>
void do_test_cyl_bessel_j_int(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -93,19 +95,19 @@
//
// test cyl_bessel_j against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_bessel_j", test_name);
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_sph_bessel_j(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(unsigned, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -124,10 +126,10 @@
//
// test sph_bessel against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int1(funcp, 0, 1),
- extract_result(2));
+ bind_func_int1<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::sph_bessel", test_name);
std::cout << std::endl;
}
@@ -142,7 +144,7 @@
// three items, input value a, input value b and erf(a, b):
//
// function values calculated on http://functions.wolfram.com/
- static const boost::array<boost::array<T, 3>, 8> j0_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 8> j0_data = {{
{{ SC_(0), SC_(0), SC_(1) }},
{{ SC_(0), SC_(1), SC_(0.7651976865579665514497175261026632209093) }},
{{ SC_(0), SC_(-2), SC_(0.2238907791412356680518274546499486258252) }},
@@ -157,13 +159,13 @@
{{ SC_(0), SC_(1e+03), SC_(0.02478668615242017456133073111569370878617) }},
{{ SC_(0), SC_(1e+05), SC_(-0.001719201116235972192570601477073201747532) }},
// test at the roots:
- {{ SC_(0), SC_(2521642)/(1024 * 1024), SC_(1.80208819970046790002973759410972422387259992955354630042138e-7) }},
- {{ SC_(0), SC_(5788221)/(1024 * 1024), SC_(-1.37774249380686777043369399806210229535671843632174587432454e-7) }},
- {{ SC_(0), SC_(9074091)/(1024 * 1024), SC_(1.03553057441100845081018471279571355857520645127532785991335e-7) }},
- {{ SC_(0), SC_(12364320)/(1024 * 1024), SC_(-3.53017140778223781420794006033810387155048392363051866610931e-9) }}
+ {{ SC_(0), T(2521642)/(1024 * 1024), SC_(1.80208819970046790002973759410972422387259992955354630042138e-7) }},
+ {{ SC_(0), T(5788221)/(1024 * 1024), SC_(-1.37774249380686777043369399806210229535671843632174587432454e-7) }},
+ {{ SC_(0), T(9074091)/(1024 * 1024), SC_(1.03553057441100845081018471279571355857520645127532785991335e-7) }},
+ {{ SC_(0), T(12364320)/(1024 * 1024), SC_(-3.53017140778223781420794006033810387155048392363051866610931e-9) }}
}};
- static const boost::array<boost::array<T, 3>, 8> j1_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 8> j1_data = {{
{{ SC_(1), SC_(0), SC_(0) }},
{{ SC_(1), SC_(1), SC_(0.4400505857449335159596822037189149131274) }},
{{ SC_(1), SC_(-2), SC_(-0.5767248077568733872024482422691370869203) }},
@@ -178,12 +180,12 @@
{{ SC_(1), SC_(1e+03), SC_(4.728311907089523917576071901216916285418e-03) }},
{{ SC_(1), SC_(1e+05), SC_(1.846757562882567716362123967114215743694e-03) }},
// test zeros:
- {{ SC_(1), SC_(4017834)/(1024*1024), SC_(3.53149033321258645807835062770856949751958513973522222203044e-7) }},
- {{ SC_(1), SC_(7356375)/(1024*1024), SC_(-2.31227973111067286051984021150135526024117175836722748404342e-7) }},
- {{ SC_(1), SC_(10667654)/(1024*1024), SC_(1.24591331097191900488116495350277530373473085499043086981229e-7) }},
+ {{ SC_(1), T(4017834)/(1024*1024), SC_(3.53149033321258645807835062770856949751958513973522222203044e-7) }},
+ {{ SC_(1), T(7356375)/(1024*1024), SC_(-2.31227973111067286051984021150135526024117175836722748404342e-7) }},
+ {{ SC_(1), T(10667654)/(1024*1024), SC_(1.24591331097191900488116495350277530373473085499043086981229e-7) }},
}};
- static const boost::array<boost::array<T, 3>, 16> jn_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 16> jn_data = {{
// This first one is a modified test case from https://svn.boost.org/trac/boost/ticket/2733
{{ SC_(-1), SC_(1.25), SC_(-0.510623260319880467069474837274910375352924050139633057168856) }},
{{ SC_(2), SC_(0), SC_(0) }},
@@ -202,23 +204,23 @@
{{ SC_(1e+03), SC_(1e+05), SC_(1.283178112502480365195139312635384057363e-03) }},
{{ SC_(10), SC_(1e-100), SC_(2.69114445546737213403880070546737213403880070546737213403880e-1010) }},
}};
- do_test_cyl_bessel_j(j0_data, name, "Bessel J0: Mathworld Data");
- do_test_cyl_bessel_j(j0_tricky, name, "Bessel J0: Mathworld Data (Tricky cases)");
- do_test_cyl_bessel_j(j1_data, name, "Bessel J1: Mathworld Data");
- do_test_cyl_bessel_j(j1_tricky, name, "Bessel J1: Mathworld Data (tricky cases)");
- do_test_cyl_bessel_j(jn_data, name, "Bessel JN: Mathworld Data");
-
- do_test_cyl_bessel_j_int(j0_data, name, "Bessel J0: Mathworld Data (Integer Version)");
- do_test_cyl_bessel_j_int(j0_tricky, name, "Bessel J0: Mathworld Data (Tricky cases) (Integer Version)");
- do_test_cyl_bessel_j_int(j1_data, name, "Bessel J1: Mathworld Data (Integer Version)");
- do_test_cyl_bessel_j_int(j1_tricky, name, "Bessel J1: Mathworld Data (tricky cases) (Integer Version)");
- do_test_cyl_bessel_j_int(jn_data, name, "Bessel JN: Mathworld Data (Integer Version)");
+ do_test_cyl_bessel_j<T>(j0_data, name, "Bessel J0: Mathworld Data");
+ do_test_cyl_bessel_j<T>(j0_tricky, name, "Bessel J0: Mathworld Data (Tricky cases)");
+ do_test_cyl_bessel_j<T>(j1_data, name, "Bessel J1: Mathworld Data");
+ do_test_cyl_bessel_j<T>(j1_tricky, name, "Bessel J1: Mathworld Data (tricky cases)");
+ do_test_cyl_bessel_j<T>(jn_data, name, "Bessel JN: Mathworld Data");
+
+ do_test_cyl_bessel_j_int<T>(j0_data, name, "Bessel J0: Mathworld Data (Integer Version)");
+ do_test_cyl_bessel_j_int<T>(j0_tricky, name, "Bessel J0: Mathworld Data (Tricky cases) (Integer Version)");
+ do_test_cyl_bessel_j_int<T>(j1_data, name, "Bessel J1: Mathworld Data (Integer Version)");
+ do_test_cyl_bessel_j_int<T>(j1_tricky, name, "Bessel J1: Mathworld Data (tricky cases) (Integer Version)");
+ do_test_cyl_bessel_j_int<T>(jn_data, name, "Bessel JN: Mathworld Data (Integer Version)");
- static const boost::array<boost::array<T, 3>, 18> jv_data = {{
+ static const boost::array<boost::array<T, 3>, 20> jv_data = {{
//SC_(-2.4), {{ SC_(0), std::numeric_limits<T>::infinity() }},
- {{ SC_(2457)/1024, SC_(1)/1024, SC_(3.80739920118603335646474073457326714709615200130620574875292e-9) }},
- {{ SC_(5.5), SC_(3217)/1024, SC_(0.0281933076257506091621579544064767140470089107926550720453038) }},
- {{ SC_(-5.5), SC_(3217)/1024, SC_(-2.55820064470647911823175836997490971806135336759164272675969) }},
+ {{ T(2457)/1024, T(1)/1024, SC_(3.80739920118603335646474073457326714709615200130620574875292e-9) }},
+ {{ SC_(5.5), T(3217)/1024, SC_(0.0281933076257506091621579544064767140470089107926550720453038) }},
+ {{ SC_(-5.5), T(3217)/1024, SC_(-2.55820064470647911823175836997490971806135336759164272675969) }},
{{ SC_(-5.5), SC_(1e+04), SC_(2.449843111985605522111159013846599118397e-03) }},
{{ SC_(5.5), SC_(1e+04), SC_(0.00759343502722670361395585198154817047185480147294665270646578) }},
{{ SC_(5.5), SC_(1e+06), SC_(-0.000747424248595630177396350688505919533097973148718960064663632) }},
@@ -228,15 +230,17 @@
{{ SC_(-5.5), SC_(1e+04), SC_(0.00244984311198560552211115901384659911839737686676766460822577) }},
{{ SC_(-5.5), SC_(1e+06), SC_(0.000279243200433579511095229508894156656558211060453622750659554) }},
{{ SC_(-0.5), SC_(101), SC_(0.0708184798097594268482290389188138201440114881159344944791454) }},
- {{ SC_(-10486074) / (1024*1024), SC_(1)/1024, SC_(1.41474013160494695750009004222225969090304185981836460288562e35) }},
- {{ SC_(-10486074) / (1024*1024), SC_(15), SC_(-0.0902239288885423309568944543848111461724911781719692852541489) }},
- {{ SC_(10486074) / (1024*1024), SC_(1e+02), SC_(-0.0547064914615137807616774867984047583596945624129838091326863) }},
- {{ SC_(10486074) / (1024*1024), SC_(2e+04), SC_(-0.00556783614400875611650958980796060611309029233226596737701688) }},
- {{ SC_(-10486074) / (1024*1024), SC_(1e+02), SC_(-0.0547613660316806551338637153942604550779513947674222863858713) }},
+ {{ T(-10486074) / (1024*1024), T(1)/1024, SC_(1.41474013160494695750009004222225969090304185981836460288562e35) }},
+ {{ T(-10486074) / (1024*1024), SC_(15), SC_(-0.0902239288885423309568944543848111461724911781719692852541489) }},
+ {{ T(10486074) / (1024*1024), SC_(1e+02), SC_(-0.0547064914615137807616774867984047583596945624129838091326863) }},
+ {{ T(10486074) / (1024*1024), SC_(2e+04), SC_(-0.00556783614400875611650958980796060611309029233226596737701688) }},
+ {{ T(-10486074) / (1024*1024), SC_(1e+02), SC_(-0.0547613660316806551338637153942604550779513947674222863858713) }},
// Bug report https://svn.boost.org/trac/boost/ticket/4812:
- {{ SC_(1.5), SC_(8034)/1024, SC_(0.0339477646369710610146236955872928005087352629422508823945264) }},
+ {{ SC_(1.5), T(8034)/1024, SC_(0.0339477646369710610146236955872928005087352629422508823945264) }},
+ {{ SC_(8.5), boost::math::constants::pi<T>() * 4, SC_(0.0436807946352780974532519564114026730332781693877984686758680) }},
+ {{ SC_(-8.5), boost::math::constants::pi<T>() * 4, SC_(-0.257086543428224355151772807588810984369026142375675714560864) }},
}};
- do_test_cyl_bessel_j(jv_data, name, "Bessel J: Mathworld Data");
+ do_test_cyl_bessel_j<T>(jv_data, name, "Bessel J: Mathworld Data");
static const boost::array<boost::array<T, 3>, 4> jv_large_data = {{
// Bug report https://svn.boost.org/trac/boost/ticket/5560:
{{ SC_(-0.5), static_cast<T>(std::ldexp(0.5, -683)), SC_(7.14823099969225685526188875418476476336424046896822867989728e102) }},
@@ -245,18 +249,18 @@
{{ SC_(-2.5), SC_(4), SC_(-0.0145679476685218007666785535204236327832335803441449596297004) }},
}};
if(jv_large_data[0][1] != 0)
- do_test_cyl_bessel_j(jv_data, name, "Bessel J: Mathworld Data (large values)");
+ do_test_cyl_bessel_j<T>(jv_large_data, name, "Bessel J: Mathworld Data (large values)");
#include "bessel_j_int_data.ipp"
- do_test_cyl_bessel_j(bessel_j_int_data, name, "Bessel JN: Random Data");
+ do_test_cyl_bessel_j<T>(bessel_j_int_data, name, "Bessel JN: Random Data");
#include "bessel_j_data.ipp"
- do_test_cyl_bessel_j(bessel_j_data, name, "Bessel J: Random Data");
+ do_test_cyl_bessel_j<T>(bessel_j_data, name, "Bessel J: Random Data");
#include "bessel_j_large_data.ipp"
- do_test_cyl_bessel_j(bessel_j_large_data, name, "Bessel J: Random Data (Tricky large values)");
+ do_test_cyl_bessel_j<T>(bessel_j_large_data, name, "Bessel J: Random Data (Tricky large values)");
#include "sph_bessel_data.ipp"
- do_test_sph_bessel_j(sph_bessel_data, name, "Bessel j: Random Data");
+ do_test_sph_bessel_j<T>(sph_bessel_data, name, "Bessel j: Random Data");
}
Modified: branches/release/libs/math/test/test_bessel_k.cpp
==============================================================================
--- branches/release/libs/math/test/test_bessel_k.cpp (original)
+++ branches/release/libs/math/test/test_bessel_k.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -73,6 +73,13 @@
".*", 4000, 1300); // test function
add_expected_result(
+ "GNU.*", // compiler
+ ".*", // stdlib
+ "Win32.*", // platform
+ largest_type, // test type(s)
+ ".*large.*", // test data group
+ ".*", 250, 100); // test function
+ add_expected_result(
".*", // compiler
".*", // stdlib
".*", // platform
Modified: branches/release/libs/math/test/test_bessel_k.hpp
==============================================================================
--- branches/release/libs/math/test/test_bessel_k.hpp (original)
+++ branches/release/libs/math/test/test_bessel_k.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -14,9 +14,10 @@
#include "handle_test_result.hpp"
#include "test_bessel_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+# define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
template <class T>
@@ -27,11 +28,11 @@
boost::math::itrunc(v), x));
}
-template <class T>
+template <class Real, class T>
void do_test_cyl_bessel_k(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -48,10 +49,10 @@
//
// test cyl_bessel_k against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_bessel_k", test_name);
std::cout << std::endl;
@@ -63,21 +64,21 @@
//
// test other::cyl_bessel_k against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::cyl_bessel_k");
std::cout << std::endl;
}
#endif
}
-template <class T>
+template <class Real, class T>
void do_test_cyl_bessel_k_int(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -94,10 +95,10 @@
//
// test cyl_bessel_k against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_bessel_k", test_name);
std::cout << std::endl;
}
@@ -143,14 +144,14 @@
{{ SC_(0.5), SC_(0.875), SC_(0.558532231646608646115729767013630967055657943463362504577189) }},
{{ SC_(0.5), SC_(1.125), SC_(0.383621010650189547146769320487006220295290256657827220786527) }},
{{ SC_(2.25), T(std::ldexp(1.0, -30)), SC_(5.62397392719283271332307799146649700147907612095185712015604e20) }},
- {{ SC_(5.5), SC_(3217)/1024, SC_(1.30623288775012596319554857587765179889689223531159532808379) }},
+ {{ SC_(5.5), T(3217)/1024, SC_(1.30623288775012596319554857587765179889689223531159532808379) }},
{{ SC_(-5.5), SC_(10), SC_(0.0000733045300798502164644836879577484533096239574909573072142667) }},
{{ SC_(-5.5), SC_(100), SC_(5.41274555306792267322084448693957747924412508020839543293369e-45) }},
- {{ SC_(10240)/1024, SC_(1)/1024, SC_(2.35522579263922076203415803966825431039900000000993410734978e38) }},
- {{ SC_(10240)/1024, SC_(10), SC_(0.00161425530039067002345725193091329085443750382929208307802221) }},
- {{ SC_(144793)/1024, SC_(100), SC_(1.39565245860302528069481472855619216759142225046370312329416e-6) }},
- {{ SC_(144793)/1024, SC_(200), SC_(9.11950412043225432171915100042647230802198254567007382956336e-68) }},
- {{ SC_(-144793)/1024, SC_(50), SC_(1.30185229717525025165362673848737761549946548375142378172956e42) }},
+ {{ T(10240)/1024, T(1)/1024, SC_(2.35522579263922076203415803966825431039900000000993410734978e38) }},
+ {{ T(10240)/1024, SC_(10), SC_(0.00161425530039067002345725193091329085443750382929208307802221) }},
+ {{ T(144793)/1024, SC_(100), SC_(1.39565245860302528069481472855619216759142225046370312329416e-6) }},
+ {{ T(144793)/1024, SC_(200), SC_(9.11950412043225432171915100042647230802198254567007382956336e-68) }},
+ {{ T(-144793)/1024, SC_(50), SC_(1.30185229717525025165362673848737761549946548375142378172956e42) }},
}};
static const boost::array<boost::array<T, 3>, 5> kv_large_data = {{
// Bug report https://svn.boost.org/trac/boost/ticket/5560:
@@ -161,20 +162,20 @@
{{ SC_(0.5), static_cast<T>(ldexp(0.5, -683)), SC_(1.12284149973980088540335945247019177715948513804063794284101e103) }},
}};
- do_test_cyl_bessel_k(k0_data, name, "Bessel K0: Mathworld Data");
- do_test_cyl_bessel_k(k1_data, name, "Bessel K1: Mathworld Data");
- do_test_cyl_bessel_k(kn_data, name, "Bessel Kn: Mathworld Data");
-
- do_test_cyl_bessel_k_int(k0_data, name, "Bessel K0: Mathworld Data (Integer Version)");
- do_test_cyl_bessel_k_int(k1_data, name, "Bessel K1: Mathworld Data (Integer Version)");
- do_test_cyl_bessel_k_int(kn_data, name, "Bessel Kn: Mathworld Data (Integer Version)");
+ do_test_cyl_bessel_k<T>(k0_data, name, "Bessel K0: Mathworld Data");
+ do_test_cyl_bessel_k<T>(k1_data, name, "Bessel K1: Mathworld Data");
+ do_test_cyl_bessel_k<T>(kn_data, name, "Bessel Kn: Mathworld Data");
+
+ do_test_cyl_bessel_k_int<T>(k0_data, name, "Bessel K0: Mathworld Data (Integer Version)");
+ do_test_cyl_bessel_k_int<T>(k1_data, name, "Bessel K1: Mathworld Data (Integer Version)");
+ do_test_cyl_bessel_k_int<T>(kn_data, name, "Bessel Kn: Mathworld Data (Integer Version)");
- do_test_cyl_bessel_k(kv_data, name, "Bessel Kv: Mathworld Data");
+ do_test_cyl_bessel_k<T>(kv_data, name, "Bessel Kv: Mathworld Data");
if(0 != static_cast<T>(ldexp(0.5, -512)))
- do_test_cyl_bessel_k(kv_large_data, name, "Bessel Kv: Mathworld Data (large values)");
+ do_test_cyl_bessel_k<T>(kv_large_data, name, "Bessel Kv: Mathworld Data (large values)");
#include "bessel_k_int_data.ipp"
- do_test_cyl_bessel_k(bessel_k_int_data, name, "Bessel Kn: Random Data");
+ do_test_cyl_bessel_k<T>(bessel_k_int_data, name, "Bessel Kn: Random Data");
#include "bessel_k_data.ipp"
- do_test_cyl_bessel_k(bessel_k_data, name, "Bessel Kv: Random Data");
+ do_test_cyl_bessel_k<T>(bessel_k_data, name, "Bessel Kv: Random Data");
}
Modified: branches/release/libs/math/test/test_bessel_y.cpp
==============================================================================
--- branches/release/libs/math/test/test_bessel_y.cpp (original)
+++ branches/release/libs/math/test/test_bessel_y.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -131,23 +131,23 @@
// MinGW:
//
add_expected_result(
- ".*mingw.*", // compiler
+ "GNU.*", // compiler
".*", // stdlib
- ".*", // platform
+ "Win32.*", // platform
largest_type, // test type(s)
".*Yv.*Random.*", // test data group
".*", 200000, 200000); // test function
add_expected_result(
- ".*mingw.*", // compiler
+ "GNU.*", // compiler
".*", // stdlib
- ".*", // platform
+ "Win32.*", // platform
largest_type, // test type(s)
".*Y[01v].*", // test data group
".*", 2000, 1000); // test function
add_expected_result(
- ".*mingw.*", // compiler
+ "GNU.*", // compiler
".*", // stdlib
- ".*", // platform
+ "Win32.*", // platform
largest_type, // test type(s)
".*Yn.*", // test data group
".*", 30000, 30000); // test function
@@ -229,6 +229,16 @@
".*", // test data group
".*", 80, 40); // test function
//
+ // One set of float tests has inexact input values, so there is a slight error:
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ "float", // test type(s)
+ "Yv: Mathworld Data", // test data group
+ ".*", 20, 20); // test function
+ //
// Finish off by printing out the compiler/stdlib/platform names,
// we do this to make it easier to mark up expected error rates.
//
Modified: branches/release/libs/math/test/test_bessel_y.hpp
==============================================================================
--- branches/release/libs/math/test/test_bessel_y.hpp (original)
+++ branches/release/libs/math/test/test_bessel_y.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -8,22 +8,24 @@
#include <boost/test/test_exec_monitor.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
+#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#include "functor.hpp"
#include "handle_test_result.hpp"
#include "test_bessel_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+# define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_cyl_neumann_y(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -40,10 +42,10 @@
//
// test cyl_neumann against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_neumann", test_name);
std::cout << std::endl;
@@ -55,10 +57,10 @@
//
// test other::cyl_neumann against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "other::cyl_neumann", test_name);
std::cout << std::endl;
}
@@ -71,11 +73,11 @@
return static_cast<T>(boost::math::cyl_neumann(boost::math::itrunc(v), x));
}
-template <class T>
+template <class Real, class T>
void do_test_cyl_neumann_y_int(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -92,19 +94,19 @@
//
// test cyl_neumann against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_neumann", test_name);
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_sph_neumann_y(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(unsigned, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -123,10 +125,10 @@
//
// test sph_neumann against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int1(funcp, 0, 1),
- extract_result(2));
+ bind_func_int1<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_neumann", test_name);
std::cout << std::endl;
}
@@ -141,7 +143,7 @@
// three items, input value a, input value b and erf(a, b):
//
// function values calculated on http://functions.wolfram.com/
- static const boost::array<boost::array<T, 3>, 9> y0_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 9> y0_data = {{
{{ SC_(0), SC_(1), SC_(0.0882569642156769579829267660235151628278175230906755467110438) }},
{{ SC_(0), SC_(2), SC_(0.510375672649745119596606592727157873268139227085846135571839) }},
{{ SC_(0), SC_(4), SC_(-0.0169407393250649919036351344471532182404925898980149027169321) }},
@@ -152,7 +154,7 @@
{{ SC_(0), SC_(1e+03), SC_(0.00471591797762281339977326146566525500985900489680197718528000) }},
{{ SC_(0), SC_(1e+05), SC_(0.00184676615886506410434074102431546125884886798090392516843524) }}
}};
- static const boost::array<boost::array<T, 3>, 9> y1_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 9> y1_data = {{
{{ SC_(1), SC_(1), SC_(-0.781212821300288716547150000047964820549906390716444607843833) }},
{{ SC_(1), SC_(2), SC_(-0.107032431540937546888370772277476636687480898235053860525795) }},
{{ SC_(1), SC_(4), SC_(0.397925710557100005253979972450791852271189181622908340876586) }},
@@ -163,7 +165,7 @@
{{ SC_(1), SC_(1e+03), SC_(-0.0247843312923517789148623560971412909386318548648705287583490) }},
{{ SC_(1), SC_(1e+05), SC_(0.00171921035008825630099494523539897102954509504993494957572726) }}
}};
- static const boost::array<boost::array<T, 3>, 10> yn_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 10> yn_data = {{
{{ SC_(2), SC_(1e-20), SC_(-1.27323954473516268615107010698011489627570899691226996904849e40) }},
{{ SC_(5), SC_(10), SC_(0.135403047689362303197029014762241709088405766746419538495983) }},
{{ SC_(-5), SC_(1e+06), SC_(0.000331052088322609048503535570014688967096938338061796192422114) }},
@@ -175,17 +177,19 @@
{{ SC_(-1e+03), SC_(7e+02), SC_(-1.88753109980945889960843803284345261796244752396992106755091e77) }},
{{ SC_(-25), SC_(8), SC_(3.45113613777297661997458045843868931827873456761831907587263e8) }}
}};
- static const boost::array<boost::array<T, 3>, 9> yv_data = {{
+ static const boost::array<boost::array<T, 3>, 11> yv_data = {{
//SC_(2.25), {{ SC_(1) / 1024, SC_(-1.01759203636941035147948317764932151601257765988969544340275e7) }},
- {{ SC_(0.5), SC_(1) / (1024*1024), SC_(-817.033790261762580469303126467917092806755460418223776544122) }},
+ {{ SC_(0.5), T(1) / (1024*1024), SC_(-817.033790261762580469303126467917092806755460418223776544122) }},
{{ SC_(5.5), SC_(3.125), SC_(-2.61489440328417468776474188539366752698192046890955453259866) }},
{{ SC_(-5.5), SC_(3.125), SC_(-0.0274994493896489729948109971802244976377957234563871795364056) }},
{{ SC_(-5.5), SC_(1e+04), SC_(-0.00759343502722670361395585198154817047185480147294665270646578) }},
- {{ SC_(-10486074) / (1024*1024), SC_(1)/1024, SC_(-1.50382374389531766117868938966858995093408410498915220070230e38) }},
- {{ SC_(-10486074) / (1024*1024), SC_(1e+02), SC_(0.0583041891319026009955779707640455341990844522293730214223545) }},
+ {{ T(-10486074) / (1024*1024), T(1)/1024, SC_(-1.50382374389531766117868938966858995093408410498915220070230e38) }},
+ {{ T(-10486074) / (1024*1024), SC_(1e+02), SC_(0.0583041891319026009955779707640455341990844522293730214223545) }},
{{ SC_(141.75), SC_(1e+02), SC_(-5.38829231428696507293191118661269920130838607482708483122068e9) }},
{{ SC_(141.75), SC_(2e+04), SC_(-0.00376577888677186194728129112270988602876597726657372330194186) }},
{{ SC_(-141.75), SC_(1e+02), SC_(-3.81009803444766877495905954105669819951653361036342457919021e9) }},
+ {{ SC_(8.5), boost::math::constants::pi<T>() * 4, SC_(0.257086543428224355151772807588810984369026142375675714560864) }},
+ {{ SC_(-8.5), boost::math::constants::pi<T>() * 4, SC_(0.0436807946352780974532519564114026730332781693877984686758680) }},
}};
static const boost::array<boost::array<T, 3>, 7> yv_large_data = {{
// Bug report https://svn.boost.org/trac/boost/ticket/5560:
@@ -198,24 +202,24 @@
{{ SC_(10.0), static_cast<T>(std::ldexp(1.0, -53)), SC_(-4.15729476804920974669173904282420477878640623992500096231384e167) }},
}};
- do_test_cyl_neumann_y(y0_data, name, "Y0: Mathworld Data");
- do_test_cyl_neumann_y(y1_data, name, "Y1: Mathworld Data");
- do_test_cyl_neumann_y(yn_data, name, "Yn: Mathworld Data");
- do_test_cyl_neumann_y_int(y0_data, name, "Y0: Mathworld Data (Integer Version)");
- do_test_cyl_neumann_y_int(y1_data, name, "Y1: Mathworld Data (Integer Version)");
- do_test_cyl_neumann_y_int(yn_data, name, "Yn: Mathworld Data (Integer Version)");
- do_test_cyl_neumann_y(yv_data, name, "Yv: Mathworld Data");
+ do_test_cyl_neumann_y<T>(y0_data, name, "Y0: Mathworld Data");
+ do_test_cyl_neumann_y<T>(y1_data, name, "Y1: Mathworld Data");
+ do_test_cyl_neumann_y<T>(yn_data, name, "Yn: Mathworld Data");
+ do_test_cyl_neumann_y_int<T>(y0_data, name, "Y0: Mathworld Data (Integer Version)");
+ do_test_cyl_neumann_y_int<T>(y1_data, name, "Y1: Mathworld Data (Integer Version)");
+ do_test_cyl_neumann_y_int<T>(yn_data, name, "Yn: Mathworld Data (Integer Version)");
+ do_test_cyl_neumann_y<T>(yv_data, name, "Yv: Mathworld Data");
if(yv_large_data[0][1] != 0)
- do_test_cyl_neumann_y(yv_large_data, name, "Yv: Mathworld Data (large values)");
+ do_test_cyl_neumann_y<T>(yv_large_data, name, "Yv: Mathworld Data (large values)");
#include "bessel_y01_data.ipp"
- do_test_cyl_neumann_y(bessel_y01_data, name, "Y0 and Y1: Random Data");
+ do_test_cyl_neumann_y<T>(bessel_y01_data, name, "Y0 and Y1: Random Data");
#include "bessel_yn_data.ipp"
- do_test_cyl_neumann_y(bessel_yn_data, name, "Yn: Random Data");
+ do_test_cyl_neumann_y<T>(bessel_yn_data, name, "Yn: Random Data");
#include "bessel_yv_data.ipp"
- do_test_cyl_neumann_y(bessel_yv_data, name, "Yv: Random Data");
+ do_test_cyl_neumann_y<T>(bessel_yv_data, name, "Yv: Random Data");
#include "sph_neumann_data.ipp"
- do_test_sph_neumann_y(sph_neumann_data, name, "y: Random Data");
+ do_test_sph_neumann_y<T>(sph_neumann_data, name, "y: Random Data");
}
Modified: branches/release/libs/math/test/test_beta.hpp
==============================================================================
--- branches/release/libs/math/test/test_beta.hpp (original)
+++ branches/release/libs/math/test/test_beta.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -23,18 +23,19 @@
#include "test_beta_hooks.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#undef small // VC++ #defines small char !!!!!!
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_beta(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -51,18 +52,18 @@
//
// test beta against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::beta", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::beta;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::beta");
}
#endif
@@ -79,15 +80,15 @@
//
# include "beta_small_data.ipp"
- do_test_beta(beta_small_data, name, "Beta Function: Small Values");
+ do_test_beta<T>(beta_small_data, name, "Beta Function: Small Values");
# include "beta_med_data.ipp"
- do_test_beta(beta_med_data, name, "Beta Function: Medium Values");
+ do_test_beta<T>(beta_med_data, name, "Beta Function: Medium Values");
# include "beta_exp_data.ipp"
- do_test_beta(beta_exp_data, name, "Beta Function: Divergent Values");
+ do_test_beta<T>(beta_exp_data, name, "Beta Function: Divergent Values");
}
template <class T>
Modified: branches/release/libs/math/test/test_binomial.cpp
==============================================================================
--- branches/release/libs/math/test/test_binomial.cpp (original)
+++ branches/release/libs/math/test/test_binomial.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -31,6 +31,7 @@
#include <boost/test/test_exec_monitor.hpp> // for test_main
#include <boost/test/floating_point_comparison.hpp> // for BOOST_CHECK_CLOSE
+#include "table_type.hpp"
#include <iostream>
using std::cout;
@@ -626,13 +627,7 @@
//7 0.00036621093749999984 0.9999847412109375
//8 1.52587890625e-005 1 1 0
}
-#if !defined(TEST_REAL_CONCEPT)
#define T RealType
-#else
- // This reduces compile time and compiler memory usage by storing test data
- // as an array of long double's rather than an array of real_concept's:
-#define T long double
-#endif
#include "binomial_quantile.ipp"
for(unsigned i = 0; i < binomial_quantile_data.size(); ++i)
@@ -734,7 +729,7 @@
#ifdef TEST_LDOUBLE
test_spots(0.0L); // Test long double.
#endif
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+#if !defined(BOOST_MATH_NO_REAL_CONCEPT_TESTS)
#ifdef TEST_REAL_CONCEPT
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
Modified: branches/release/libs/math/test/test_binomial_coeff.hpp
==============================================================================
--- branches/release/libs/math/test/test_binomial_coeff.hpp (original)
+++ branches/release/libs/math/test/test_binomial_coeff.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -14,10 +14,10 @@
#include <boost/array.hpp>
#include "handle_test_result.hpp"
-
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
template <class T>
@@ -42,10 +42,10 @@
#include "binomial_data.ipp"
- boost::math::tools::test_result<T> result = boost::math::tools::test(
+ boost::math::tools::test_result<T> result = boost::math::tools::test_hetero<T>(
binomial_data,
- bind_func(f, 0, 1),
- extract_result(2));
+ bind_func<T>(f, 0, 1),
+ extract_result<T>(2));
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
"Test results for small arguments and type " << type_name << std::endl << std::endl;
@@ -55,10 +55,10 @@
#include "binomial_large_data.ipp"
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<T>(
binomial_large_data,
- bind_func(f, 0, 1),
- extract_result(2));
+ bind_func<T>(f, 0, 1),
+ extract_result<T>(2));
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
"Test results for large arguments and type " << type_name << std::endl << std::endl;
Modified: branches/release/libs/math/test/test_carlson.hpp
==============================================================================
--- branches/release/libs/math/test/test_carlson.hpp (original)
+++ branches/release/libs/math/test/test_carlson.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -14,16 +14,17 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_rf(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
@@ -34,10 +35,10 @@
#endif
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp, 0, 1, 2),
- extract_result(3));
+ bind_func<Real>(fp, 0, 1, 2),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_rf", test);
@@ -45,11 +46,11 @@
}
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_rc(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
@@ -60,22 +61,22 @@
#endif
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp, 0, 1),
- extract_result(2));
- handle_test_result(result, data[result.worst()], result.worst(),
+ bind_func<Real>(fp, 0, 1),
+ extract_result<Real>(2));
+ handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_rc", test);
std::cout << std::endl;
}
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_rj(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
@@ -86,22 +87,22 @@
#endif
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp, 0, 1, 2, 3),
- extract_result(4));
- handle_test_result(result, data[result.worst()], result.worst(),
+ bind_func<Real>(fp, 0, 1, 2, 3),
+ extract_result<Real>(4));
+ handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_rf", test);
std::cout << std::endl;
}
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_rd(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
@@ -112,11 +113,11 @@
#endif
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp, 0, 1, 2),
- extract_result(3));
- handle_test_result(result, data[result.worst()], result.worst(),
+ bind_func<Real>(fp, 0, 1, 2),
+ extract_result<Real>(3));
+ handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_rd", test);
std::cout << std::endl;
@@ -202,18 +203,18 @@
//
#include "ellint_rf_data.ipp"
- do_test_ellint_rf(ellint_rf_data, type_name, "RF: Random data");
+ do_test_ellint_rf<T>(ellint_rf_data, type_name, "RF: Random data");
#include "ellint_rc_data.ipp"
- do_test_ellint_rc(ellint_rc_data, type_name, "RC: Random data");
+ do_test_ellint_rc<T>(ellint_rc_data, type_name, "RC: Random data");
#include "ellint_rj_data.ipp"
- do_test_ellint_rj(ellint_rj_data, type_name, "RJ: Random data");
+ do_test_ellint_rj<T>(ellint_rj_data, type_name, "RJ: Random data");
#include "ellint_rd_data.ipp"
- do_test_ellint_rd(ellint_rd_data, type_name, "RD: Random data");
+ do_test_ellint_rd<T>(ellint_rd_data, type_name, "RD: Random data");
}
Modified: branches/release/libs/math/test/test_cbrt.hpp
==============================================================================
--- branches/release/libs/math/test/test_cbrt.hpp (original)
+++ branches/release/libs/math/test/test_cbrt.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -15,28 +15,30 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
+template <class Real>
struct negative_cbrt
{
negative_cbrt(){}
template <class S>
- typename S::value_type operator()(const S& row)
+ Real operator()(const S& row)
{
- return boost::math::cbrt(-row[1]);
+ return boost::math::cbrt(-Real(row[1]));
}
};
-template <class T>
+template <class Real, class T>
void do_test_cbrt(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -53,14 +55,14 @@
//
// test cbrt against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 1),
- extract_result(0));
- result += boost::math::tools::test(
+ bind_func<Real>(funcp, 1),
+ extract_result<Real>(0));
+ result += boost::math::tools::test_hetero<Real>(
data,
- negative_cbrt(),
- negate(extract_result(0)));
+ negative_cbrt<Real>(),
+ negate<Real>(extract_result<Real>(0)));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cbrt", test_name);
std::cout << std::endl;
}
@@ -75,7 +77,7 @@
//
# include "cbrt_data.ipp"
- do_test_cbrt(cbrt_data, name, "cbrt Function");
+ do_test_cbrt<T>(cbrt_data, name, "cbrt Function");
}
Modified: branches/release/libs/math/test/test_chi_squared.cpp
==============================================================================
--- branches/release/libs/math/test/test_chi_squared.cpp (original)
+++ branches/release/libs/math/test/test_chi_squared.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -535,7 +535,7 @@
test_spots(0.0); // Test double.
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L); // Test long double.
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+#if !defined(BOOST_MATH_NO_REAL_CONCEPT_TESTS)
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
#endif
Modified: branches/release/libs/math/test/test_constants.cpp
==============================================================================
--- branches/release/libs/math/test/test_constants.cpp (original)
+++ branches/release/libs/math/test/test_constants.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,5 +1,5 @@
-// Copyright Paul Bristow 2007.
-// Copyright John Maddock 2006.
+// Copyright Paul Bristow 2007, 2011.
+// Copyright John Maddock 2006, 2011.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0.
@@ -8,7 +8,16 @@
// test_constants.cpp
-#include <pch.hpp>
+// Check values of constants are drawn from an independent source, or calculated.
+// Both must be at long double precision for the most precise compilers floating-point implementation.
+// So all values use static_cast<RealType>() of values at least 40 decimal digits
+// and that have suffix L to ensure floating-point type is long double.
+
+// Steve Moshier's command interpreter V1.3 100 digits calculator used for some values.
+
+#ifdef _MSC_VER
+# pragma warning(disable : 4127) // conditional expression is constant.
+#endif
#include <boost/math/concepts/real_concept.hpp> // for real_concept
#include <boost/test/test_exec_monitor.hpp> // Boost.Test
@@ -16,55 +25,737 @@
#include <boost/math/constants/constants.hpp>
#include <boost/math/tools/test.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/utility/enable_if.hpp>
+
+// Check at compile time that the construction method for constants of type float, is "construct from a float", or "construct from a double", ...
+BOOST_STATIC_ASSERT((boost::is_same<boost::math::constants::construction_traits<float, boost::math::policies::policy<> >::type, boost::mpl::int_<boost::math::constants::construct_from_float> >::value));
+BOOST_STATIC_ASSERT((boost::is_same<boost::math::constants::construction_traits<double, boost::math::policies::policy<> >::type, boost::mpl::int_<boost::math::constants::construct_from_double> >::value));
+BOOST_STATIC_ASSERT((boost::is_same<boost::math::constants::construction_traits<long double, boost::math::policies::policy<> >::type, boost::mpl::int_<(sizeof(double) == sizeof(long double) ? boost::math::constants::construct_from_double : boost::math::constants::construct_from_long_double)> >::value));
+BOOST_STATIC_ASSERT((boost::is_same<boost::math::constants::construction_traits<boost::math::concepts::real_concept, boost::math::policies::policy<> >::type, boost::mpl::int_<0> >::value));
+
+// Policy to set precision at maximum possible using long double.
+typedef boost::math::policies::policy<boost::math::policies::digits2<std::numeric_limits<long double>::digits> > real_concept_policy_1;
+// Policy with precision +2 (could be any reasonable value),
+// forces the precision of the policy to be greater than
+// that of a long double, and therefore triggers different code (construct from string).
+typedef boost::math::policies::policy<boost::math::policies::digits2<std::numeric_limits<long double>::digits + 2> > real_concept_policy_2;
+
+BOOST_STATIC_ASSERT((boost::is_same<boost::math::constants::construction_traits<boost::math::concepts::real_concept, real_concept_policy_1 >::type, boost::mpl::int_<(sizeof(double) == sizeof(long double) ? boost::math::constants::construct_from_double : boost::math::constants::construct_from_long_double) > >::value));
+BOOST_STATIC_ASSERT((boost::is_same<boost::math::constants::construction_traits<boost::math::concepts::real_concept, real_concept_policy_2 >::type, boost::mpl::int_<boost::math::constants::construct_from_string> >::value));
+
+// We need to declare a conceptual type whose precision is unknown at
+// compile time, and is so enormous when checked at runtime,
+// that we're forced to calculate the values of the constants ourselves.
+
+namespace boost{ namespace math{ namespace concepts{
+
+class big_real_concept : public real_concept
+{
+public:
+ big_real_concept() {}
+ template <class T>
+ big_real_concept(const T& t, typename enable_if<is_convertible<T, real_concept> >::type* = 0) : real_concept(t) {}
+};
+
+inline int itrunc(const big_real_concept& val)
+{
+ BOOST_MATH_STD_USING
+ return itrunc(val.value());
+}
+
+}
+namespace tools{
+
+template <>
+inline int digits<concepts::big_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T))
+{
+ return 2 * boost::math::constants::max_string_digits;
+}
+
+}}}
template <class RealType>
void test_spots(RealType)
{
- // Basic sanity checks for constants.
-
- RealType tolerance = boost::math::tools::epsilon<RealType>() * 2; // double
+ // Basic sanity checks for constants,
+ // where template parameter RealType can be float, double, long double,
+ // or real_concept, a prototype for user-defined floating-point types.
+
+ // Parameter RealType is only used to communicate the RealType,
+ // and is an arbitrary zero for all tests.
+ //
+ // Actual tolerance is never really smaller than epsilon for long double,
+ // because it's just a wrapper around a long double,
+ // so although it's pretending to be something else (in order to exercise our code),
+ // it can never really have precision greater than a long double.
+
+ typedef typename boost::math::constants::construction_traits<RealType, boost::math::policies::policy<> >::type construction_type;
+ RealType tolerance = std::max(static_cast<RealType>(boost::math::tools::epsilon<long double>()), boost::math::tools::epsilon<RealType>()) * 2; // double
+ if((construction_type::value == 0) && (boost::math::tools::digits<RealType>() > boost::math::constants::max_string_digits))
+ tolerance *= 30; // Allow a little extra tolerance
+ // for calculated (perhaps using a series representation) constants.
std::cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << "." << std::endl;
+ //typedef typename boost::math::policies::precision<RealType, boost::math::policies::policy<> >::type t1;
+ // A precision of zero means we don't know what the precision of this type is until runtime.
+ //std::cout << "Precision for type " << typeid(RealType).name() << " is " << t1::value << "." << std::endl;
+
using namespace boost::math::constants;
- using namespace std; // Help ADL of std exp, log...
- using std::exp;
+ BOOST_MATH_STD_USING
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(3.14159265358979323846264338327950288419716939937510L), pi<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(sqrt(3.14159265358979323846264338327950288419716939937510L)), root_pi<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(sqrt(3.14159265358979323846264338327950288419716939937510L/2)), root_half_pi<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(sqrt(3.14159265358979323846264338327950288419716939937510L * 2)), root_two_pi<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(sqrt(log(4.0L))), root_ln_four<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(2.71828182845904523536028747135266249775724709369995L), e<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(0.5), half<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(0.57721566490153286060651209008240243104259335L), euler<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(sqrt(2.0L)), root_two<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(log(2.0L)), ln_two<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(log(log(2.0L))), ln_ln_two<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(1)/3, third<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(2)/3, twothirds<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(0.14159265358979323846264338327950288419716939937510L), pi_minus_three<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(4. - 3.14159265358979323846264338327950288419716939937510L), four_minus_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L, pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L), root_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L/2), root_half_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L * 2), root_two_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(log(4.0L)), root_ln_four<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(2.71828182845904523536028747135266249775724709369995L, e<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.5L, half<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104259335L, euler<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(2.0L), root_two<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log(2.0L), ln_two<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log(log(2.0L)), ln_ln_two<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(1)/3, third<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(2)/3, twothirds<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.14159265358979323846264338327950288419716939937510L, pi_minus_three<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(4.L - 3.14159265358979323846264338327950288419716939937510L, four_minus_pi<RealType>(), tolerance);
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(pow((4 - 3.14159265358979323846264338327950288419716939937510L), 1.5L)), pow23_four_minus_pi<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(exp(-0.5L)), exp_minus_half<RealType>(), tolerance);
-#else
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(pow((4 - 3.14159265358979323846264338327950288419716939937510), 1.5)), pow23_four_minus_pi<RealType>(), tolerance);
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(exp(-0.5)), exp_minus_half<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow((4 - 3.14159265358979323846264338327950288419716939937510L), 1.5L), pow23_four_minus_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510L), 2.71828182845904523536028747135266249775724709369995L), pi_pow_e<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510L), 0.33333333333333333333333333333333333333333333333333L), cbrt_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(exp(-0.5L), exp_minus_half<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow(2.71828182845904523536028747135266249775724709369995L, 3.14159265358979323846264338327950288419716939937510L), e_pow_pi<RealType>(), tolerance);
+
+
+#else // Only double, so no suffix L.
+ BOOST_CHECK_CLOSE_FRACTION(pow((4 - 3.14159265358979323846264338327950288419716939937510), 1.5), pow23_four_minus_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510), 2.71828182845904523536028747135266249775724709369995), pi_pow_e<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510), 0.33333333333333333333333333333333333333333333333333), cbrt_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(exp(-0.5), exp_minus_half<RealType>(), tolerance);
+#endif
+ // Rational fractions.
+ BOOST_CHECK_CLOSE_FRACTION(0.333333333333333333333333333333333333333L, third<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.666666666666666666666666666666666666667L, two_thirds<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.75L, three_quarters<RealType>(), tolerance);
+ // Two and related.
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(2.L), root_two<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.L), root_three<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(2.L)/2, half_root_two<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log(2.L), ln_two<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log(log(2.0L)), ln_ln_two<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(log(4.0L)), root_ln_four<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1/sqrt(2.0L), one_div_root_two<RealType>(), tolerance);
+
+ // pi.
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L, pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L/2, half_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L/3, third_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L/6, sixth_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(2 * 3.14159265358979323846264338327950288419716939937510L, two_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3 * 3.14159265358979323846264338327950288419716939937510L / 4, three_quarters_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(4 * 3.14159265358979323846264338327950288419716939937510L / 3, four_thirds_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1 / (2 * 3.14159265358979323846264338327950288419716939937510L), one_div_two_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L), root_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L / 2), root_half_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(2 * 3.14159265358979323846264338327950288419716939937510L), root_two_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1 / sqrt(3.14159265358979323846264338327950288419716939937510L), one_div_root_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1 / sqrt(2 * 3.14159265358979323846264338327950288419716939937510L), one_div_root_two_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(1. / 3.14159265358979323846264338327950288419716939937510L), root_one_div_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L - 3.L, pi_minus_three<RealType>(), tolerance * 2 ); // tolerance * 2 because of cancellation loss.
+ BOOST_CHECK_CLOSE_FRACTION(4.L - 3.14159265358979323846264338327950288419716939937510L, four_minus_pi<RealType>(), tolerance );
+ // BOOST_CHECK_CLOSE_FRACTION(pow((4 - 3.14159265358979323846264338327950288419716939937510L), 1.5L), pow23_four_minus_pi<RealType>(), tolerance); See above.
+ //
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510L), 2.71828182845904523536028747135266249775724709369995L), pi_pow_e<RealType>(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L, pi_sqr<RealType>(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L/6, pi_sqr_div_six<RealType>(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L, pi_cubed<RealType>(), tolerance); // See above.
+
+ // BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L, cbrt_pi<RealType>(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(cbrt_pi<RealType>() * cbrt_pi<RealType>() * cbrt_pi<RealType>(), pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION((1)/cbrt_pi<RealType>(), one_div_cbrt_pi<RealType>(), tolerance);
+
+ // Euler
+ BOOST_CHECK_CLOSE_FRACTION(2.71828182845904523536028747135266249775724709369995L, e<RealType>(), tolerance);
+
+ //BOOST_CHECK_CLOSE_FRACTION(exp(-0.5L), exp_minus_half<RealType>(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(pow(e<RealType>(), pi<RealType>()), e_pow_pi<RealType>(), tolerance); // See also above.
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(e<RealType>()), root_e<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log10(e<RealType>()), log10_e<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1/log10(e<RealType>()), one_div_log10_e<RealType>(), tolerance);
+
+ // Trigonmetric
+ BOOST_CHECK_CLOSE_FRACTION(pi<RealType>()/180, degree<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(180 / pi<RealType>(), radian<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sin(1.L), sin_one<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cos(1.L), cos_one<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sinh(1.L), sinh_one<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cosh(1.L), cosh_one<RealType>(), tolerance);
+
+ // Phi
+ BOOST_CHECK_CLOSE_FRACTION((1.L + sqrt(5.L)) /2, phi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log((1.L + sqrt(5.L)) /2), ln_phi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1.L / log((1.L + sqrt(5.L)) /2), one_div_ln_phi<RealType>(), tolerance);
+
+ //Euler's Gamma
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992L, euler<RealType>(), tolerance); // (sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(1.L/ 0.57721566490153286060651209008240243104215933593992L, one_div_euler<RealType>(), tolerance); // (from sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992L * 0.57721566490153286060651209008240243104215933593992L, euler_sqr<RealType>(), tolerance); // (from sequence A001620 in OEIS).
+
+ // Misc
+ BOOST_CHECK_CLOSE_FRACTION(1.644934066848226436472415166646025189218949901206L, zeta_two<RealType>(), tolerance); // A013661 as a constant (usually base 10) in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.20205690315959428539973816151144999076498629234049888179227L, zeta_three<RealType>(), tolerance); // (sequence A002117 in OEIS)
+ BOOST_CHECK_CLOSE_FRACTION(.91596559417721901505460351493238411077414937428167213L, catalan<RealType>(), tolerance); // A006752 as a constant in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.1395470994046486574927930193898461120875997958365518247216557100852480077060706857071875468869385150L, extreme_value_skewness<RealType>(), tolerance); // Mathematica: N[12 Sqrt[6] Zeta[3]/Pi^3, 1101]
+ BOOST_CHECK_CLOSE_FRACTION(0.6311106578189371381918993515442277798440422031347194976580945856929268196174737254599050270325373067L, rayleigh_skewness<RealType>(), tolerance); // Mathematica: N[2 Sqrt[Pi] (Pi - 3)/((4 - Pi)^(3/2)), 1100]
+ BOOST_CHECK_CLOSE_FRACTION(2.450893006876380628486604106197544154e-01L, rayleigh_kurtosis_excess<RealType>(), tolerance * 2);
+ BOOST_CHECK_CLOSE_FRACTION(2.68545200106530644530971483548179569382038229399446295305115234555721885953715200280114117493184769799515L, khinchin<RealType>(), tolerance ); // A002210 as a constant https://oeis.org/A002210/constant
+ BOOST_CHECK_CLOSE_FRACTION(1.2824271291006226368753425688697917277676889273250011L, glaisher<RealType>(), tolerance ); // https://oeis.org/A074962/constant
+
+ //
+ // Last of all come the test cases that behave differently if we're calculating the constants on the fly:
+ //
+ if(boost::math::tools::digits<RealType>() > boost::math::constants::max_string_digits)
+ {
+ // This suffers from cancellation error, so increased tolerance:
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(4. - 3.14159265358979323846264338327950288419716939937510L), four_minus_pi<RealType>(), tolerance * 3);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(0.14159265358979323846264338327950288419716939937510L), pi_minus_three<RealType>(), tolerance * 3);
+ }
+ else
+ {
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(4. - 3.14159265358979323846264338327950288419716939937510L), four_minus_pi<RealType>(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(0.14159265358979323846264338327950288419716939937510L), pi_minus_three<RealType>(), tolerance);
+ }
+} // template <class RealType>void test_spots(RealType)
+
+void test_float_spots()
+{
+ // Basic sanity checks for constants in boost::math::float_constants::
+ // for example: boost::math::float_constants::pi
+ // (rather than boost::math::constants::pi<float>() ).
+
+ float tolerance = boost::math::tools::epsilon<float>() * 2;
+
+ using namespace boost::math::float_constants;
+ BOOST_MATH_STD_USING
+
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510F), pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(3.14159265358979323846264338327950288419716939937510F)), root_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(3.14159265358979323846264338327950288419716939937510F/2)), root_half_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(3.14159265358979323846264338327950288419716939937510F * 2)), root_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(log(4.0F))), root_ln_four, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(2.71828182845904523536028747135266249775724709369995F), e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(0.5), half, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(0.57721566490153286060651209008240243104259335F), euler, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(2.0F)), root_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(log(2.0F)), ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(log(log(2.0F))), ln_ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(1)/3, third, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(2)/3, twothirds, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(0.14159265358979323846264338327950288419716939937510F), pi_minus_three, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(4.F - 3.14159265358979323846264338327950288419716939937510F), four_minus_pi, tolerance);
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(pow((4 - 3.14159265358979323846264338327950288419716939937510F), 1.5F)), pow23_four_minus_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(pow((3.14159265358979323846264338327950288419716939937510F), 2.71828182845904523536028747135266249775724709369995F)), pi_pow_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(pow((3.14159265358979323846264338327950288419716939937510F), 0.33333333333333333333333333333333333333333333333333F)), cbrt_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(exp(-0.5F)), exp_minus_half, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(pow(2.71828182845904523536028747135266249775724709369995F, 3.14159265358979323846264338327950288419716939937510F)), e_pow_pi, tolerance);
+
+
+#else // Only double, so no suffix F.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(pow((4 - 3.14159265358979323846264338327950288419716939937510), 1.5)), pow23_four_minus_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(pow((3.14159265358979323846264338327950288419716939937510), 2.71828182845904523536028747135266249775724709369995)), pi_pow_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(pow((3.14159265358979323846264338327950288419716939937510), 0.33333333333333333333333333333333333333333333333333)), cbrt_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(exp(-0.5)), exp_minus_half, tolerance);
+#endif
+ // Rational fractions.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(0.333333333333333333333333333333333333333F), third, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(0.666666666666666666666666666666666666667F), two_thirds, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(0.75F), three_quarters, tolerance);
+ // Two and related.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(2.F)), root_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(3.F)), root_three, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(2.F)/2), half_root_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(log(2.F)), ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(log(log(2.0F))), ln_ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(log(4.0F))), root_ln_four, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(1/sqrt(2.0F)), one_div_root_two, tolerance);
+
+ // pi.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510F), pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510F/2), half_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510F/3), third_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510F/6), sixth_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(2 * 3.14159265358979323846264338327950288419716939937510F), two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3 * 3.14159265358979323846264338327950288419716939937510F / 4), three_quarters_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(4 * 3.14159265358979323846264338327950288419716939937510F / 3), four_thirds_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(1 / (2 * 3.14159265358979323846264338327950288419716939937510F)), one_div_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(3.14159265358979323846264338327950288419716939937510F)), root_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(3.14159265358979323846264338327950288419716939937510F / 2)), root_half_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(2 * 3.14159265358979323846264338327950288419716939937510F)), root_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(1 / sqrt(3.14159265358979323846264338327950288419716939937510F)), one_div_root_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(1 / sqrt(2 * 3.14159265358979323846264338327950288419716939937510F)), one_div_root_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(sqrt(1. / 3.14159265358979323846264338327950288419716939937510F)), root_one_div_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510L - 3.L), pi_minus_three, tolerance * 2 ); // tolerance * 2 because of cancellation loss.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(4.L - 3.14159265358979323846264338327950288419716939937510L), four_minus_pi, tolerance );
+ // BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(pow((4 - 3.14159265358979323846264338327950288419716939937510F), 1.5F)), pow23_four_minus_pi, tolerance); See above.
+ //
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(pow((3.14159265358979323846264338327950288419716939937510F), 2.71828182845904523536028747135266249775724709369995F)), pi_pow_e, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510F * 3.14159265358979323846264338327950288419716939937510F), pi_sqr, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510F * 3.14159265358979323846264338327950288419716939937510F/6), pi_sqr_div_six, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510F * 3.14159265358979323846264338327950288419716939937510F * 3.14159265358979323846264338327950288419716939937510F), pi_cubed, tolerance); // See above.
+
+ // BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(3.14159265358979323846264338327950288419716939937510F * 3.14159265358979323846264338327950288419716939937510F), cbrt_pi, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(cbrt_pi * cbrt_pi * cbrt_pi, pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION((static_cast<float>(1)/cbrt_pi), one_div_cbrt_pi, tolerance);
+
+ // Euler
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(2.71828182845904523536028747135266249775724709369995F), e, tolerance);
+
+ //BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(exp(-0.5F)), exp_minus_half, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(pow(e, pi), e_pow_pi, tolerance); // See also above.
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(e), root_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log10(e), log10_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<float>(1)/log10(e), one_div_log10_e, tolerance);
+
+ // Trigonmetric
+ BOOST_CHECK_CLOSE_FRACTION(pi/180, degree, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(180 / pi, radian, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sin(1.F), sin_one, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cos(1.F), cos_one, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sinh(1.F), sinh_one, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cosh(1.F), cosh_one, tolerance);
+
+ // Phi
+ BOOST_CHECK_CLOSE_FRACTION((1.F + sqrt(5.F)) /2, phi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log((1.F + sqrt(5.F)) /2), ln_phi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1.F / log((1.F + sqrt(5.F)) /2), one_div_ln_phi, tolerance);
+
+ // Euler's Gamma
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992F, euler, tolerance); // (sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(1.F/ 0.57721566490153286060651209008240243104215933593992F, one_div_euler, tolerance); // (from sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992F * 0.57721566490153286060651209008240243104215933593992F, euler_sqr, tolerance); // (from sequence A001620 in OEIS).
+
+ // Misc
+ BOOST_CHECK_CLOSE_FRACTION(1.644934066848226436472415166646025189218949901206F, zeta_two, tolerance); // A013661 as a constant (usually base 10) in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.20205690315959428539973816151144999076498629234049888179227F, zeta_three, tolerance); // (sequence A002117 in OEIS)
+ BOOST_CHECK_CLOSE_FRACTION(.91596559417721901505460351493238411077414937428167213F, catalan, tolerance); // A006752 as a constant in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.1395470994046486574927930193898461120875997958365518247216557100852480077060706857071875468869385150F, extreme_value_skewness, tolerance); // Mathematica: N[12 Sqrt[6] Zeta[3]/Pi^3, 1101]
+ BOOST_CHECK_CLOSE_FRACTION(0.6311106578189371381918993515442277798440422031347194976580945856929268196174737254599050270325373067F, rayleigh_skewness, tolerance); // Mathematica: N[2 Sqrt[Pi] (Pi - 3)/((4 - Pi)^(3/2)), 1100]
+ BOOST_CHECK_CLOSE_FRACTION(2.450893006876380628486604106197544154e-01F, rayleigh_kurtosis_excess, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(2.68545200106530644530971483548179569382038229399446295305115234555721885953715200280114117493184769799515F, khinchin, tolerance ); // A002210 as a constant https://oeis.org/A002210/constant
+ BOOST_CHECK_CLOSE_FRACTION(1.2824271291006226368753425688697917277676889273250011F, glaisher, tolerance ); // https://oeis.org/A074962/constant
+
+} // template <class RealType>void test_spots(RealType)
+
+void test_double_spots()
+{
+ // Basic sanity checks for constants in boost::math::double_constants::
+ // for example: boost::math::double_constants::pi
+ // (rather than boost::math::constants::pi<double>() ).
+
+ double tolerance = boost::math::tools::epsilon<double>() * 2;
+
+ using namespace boost::math::double_constants;
+ BOOST_MATH_STD_USING
+
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510), pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(3.14159265358979323846264338327950288419716939937510)), root_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(3.14159265358979323846264338327950288419716939937510/2)), root_half_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(3.14159265358979323846264338327950288419716939937510 * 2)), root_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(log(4.0))), root_ln_four, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(2.71828182845904523536028747135266249775724709369995), e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(0.5), half, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(0.57721566490153286060651209008240243104259335), euler, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(2.0)), root_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(log(2.0)), ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(log(log(2.0))), ln_ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(1)/3, third, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(2)/3, twothirds, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(0.14159265358979323846264338327950288419716939937510), pi_minus_three, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(4. - 3.14159265358979323846264338327950288419716939937510), four_minus_pi, tolerance);
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(pow((4 - 3.14159265358979323846264338327950288419716939937510), 1.5)), pow23_four_minus_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(pow((3.14159265358979323846264338327950288419716939937510), 2.71828182845904523536028747135266249775724709369995)), pi_pow_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(pow((3.14159265358979323846264338327950288419716939937510), 0.33333333333333333333333333333333333333333333333333)), cbrt_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(exp(-0.5)), exp_minus_half, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(pow(2.71828182845904523536028747135266249775724709369995, 3.14159265358979323846264338327950288419716939937510)), e_pow_pi, tolerance);
+
+
+#else // Only double, so no suffix .
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(pow((4 - 3.14159265358979323846264338327950288419716939937510), 1.5)), pow23_four_minus_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(pow((3.14159265358979323846264338327950288419716939937510), 2.71828182845904523536028747135266249775724709369995)), pi_pow_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(pow((3.14159265358979323846264338327950288419716939937510), 0.33333333333333333333333333333333333333333333333333)), cbrt_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(exp(-0.5)), exp_minus_half, tolerance);
#endif
+ // Rational fractions.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(0.333333333333333333333333333333333333333), third, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(0.666666666666666666666666666666666666667), two_thirds, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(0.75), three_quarters, tolerance);
+ // Two and related.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(2.)), root_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(3.)), root_three, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(2.)/2), half_root_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(log(2.)), ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(log(log(2.0))), ln_ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(log(4.0))), root_ln_four, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(1/sqrt(2.0)), one_div_root_two, tolerance);
+
+ // pi.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510), pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510/2), half_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510/3), third_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510/6), sixth_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(2 * 3.14159265358979323846264338327950288419716939937510), two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3 * 3.14159265358979323846264338327950288419716939937510 / 4), three_quarters_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(4 * 3.14159265358979323846264338327950288419716939937510 / 3), four_thirds_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(1 / (2 * 3.14159265358979323846264338327950288419716939937510)), one_div_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(3.14159265358979323846264338327950288419716939937510)), root_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(3.14159265358979323846264338327950288419716939937510 / 2)), root_half_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(2 * 3.14159265358979323846264338327950288419716939937510)), root_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(1 / sqrt(3.14159265358979323846264338327950288419716939937510)), one_div_root_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(1 / sqrt(2 * 3.14159265358979323846264338327950288419716939937510)), one_div_root_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(sqrt(1. / 3.14159265358979323846264338327950288419716939937510)), root_one_div_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510 - 3.), pi_minus_three, tolerance * 2 ); // tolerance * 2 because of cancellation loss.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(4. - 3.14159265358979323846264338327950288419716939937510), four_minus_pi, tolerance );
+ // BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(pow((4 - 3.14159265358979323846264338327950288419716939937510), 1.5)), pow23_four_minus_pi, tolerance); See above.
+ //
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(pow((3.14159265358979323846264338327950288419716939937510), 2.71828182845904523536028747135266249775724709369995)), pi_pow_e, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510 * 3.14159265358979323846264338327950288419716939937510), pi_sqr, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510 * 3.14159265358979323846264338327950288419716939937510/6), pi_sqr_div_six, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510 * 3.14159265358979323846264338327950288419716939937510 * 3.14159265358979323846264338327950288419716939937510), pi_cubed, tolerance); // See above.
+
+ // BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(3.14159265358979323846264338327950288419716939937510 * 3.14159265358979323846264338327950288419716939937510), cbrt_pi, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(cbrt_pi * cbrt_pi * cbrt_pi, pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION((static_cast<double>(1)/cbrt_pi), one_div_cbrt_pi, tolerance);
+
+ // Euler
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(2.71828182845904523536028747135266249775724709369995), e, tolerance);
+
+ //BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(exp(-0.5)), exp_minus_half, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(pow(e, pi), e_pow_pi, tolerance); // See also above.
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(e), root_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log10(e), log10_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(1)/log10(e), one_div_log10_e, tolerance);
+
+ // Trigonmetric
+ BOOST_CHECK_CLOSE_FRACTION(pi/180, degree, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(180 / pi, radian, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sin(1.), sin_one, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cos(1.), cos_one, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sinh(1.), sinh_one, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cosh(1.), cosh_one, tolerance);
+
+ // Phi
+ BOOST_CHECK_CLOSE_FRACTION((1. + sqrt(5.)) /2, phi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log((1. + sqrt(5.)) /2), ln_phi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1. / log((1. + sqrt(5.)) /2), one_div_ln_phi, tolerance);
+
+ //Euler's Gamma
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992, euler, tolerance); // (sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(1./ 0.57721566490153286060651209008240243104215933593992, one_div_euler, tolerance); // (from sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992 * 0.57721566490153286060651209008240243104215933593992, euler_sqr, tolerance); // (from sequence A001620 in OEIS).
+
+ // Misc
+ BOOST_CHECK_CLOSE_FRACTION(1.644934066848226436472415166646025189218949901206, zeta_two, tolerance); // A013661 as a constant (usually base 10) in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.20205690315959428539973816151144999076498629234049888179227, zeta_three, tolerance); // (sequence A002117 in OEIS)
+ BOOST_CHECK_CLOSE_FRACTION(.91596559417721901505460351493238411077414937428167213, catalan, tolerance); // A006752 as a constant in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.1395470994046486574927930193898461120875997958365518247216557100852480077060706857071875468869385150, extreme_value_skewness, tolerance); // Mathematica: N[12 Sqrt[6] Zeta[3]/Pi^3, 1101]
+ BOOST_CHECK_CLOSE_FRACTION(0.6311106578189371381918993515442277798440422031347194976580945856929268196174737254599050270325373067, rayleigh_skewness, tolerance); // Mathematica: N[2 Sqrt[Pi] (Pi - 3)/((4 - Pi)^(3/2)), 1100]
+ BOOST_CHECK_CLOSE_FRACTION(2.450893006876380628486604106197544154e-01, rayleigh_kurtosis_excess, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(2.68545200106530644530971483548179569382038229399446295305115234555721885953715200280114117493184769799515, khinchin, tolerance ); // A002210 as a constant https://oeis.org/A002210/constant
+ BOOST_CHECK_CLOSE_FRACTION(1.2824271291006226368753425688697917277676889273250011, glaisher, tolerance ); // https://oeis.org/A074962/constant
} // template <class RealType>void test_spots(RealType)
+void test_long_double_spots()
+{
+ // Basic sanity checks for constants in boost::math::long double_constants::
+ // for example: boost::math::long_double_constants::pi
+ // (rather than boost::math::constants::pi<long double>() ).
+
+ // All constants are tested here using at least long double precision
+ // with independent calculated or listed values,
+ // or calculations using long double (sometime a little less accurate).
+
+ long double tolerance = boost::math::tools::epsilon<long double>() * 2;
+
+ using namespace boost::math::long_double_constants;
+ BOOST_MATH_STD_USING
+
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L), pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(3.14159265358979323846264338327950288419716939937510L)), root_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(3.14159265358979323846264338327950288419716939937510L/2)), root_half_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(3.14159265358979323846264338327950288419716939937510L * 2)), root_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(log(4.0L))), root_ln_four, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(2.71828182845904523536028747135266249775724709369995L), e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(0.5), half, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(0.57721566490153286060651209008240243104259335L), euler, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(2.0L)), root_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(log(2.0L)), ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(log(log(2.0L))), ln_ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(1)/3, third, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(2)/3, twothirds, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(0.14159265358979323846264338327950288419716939937510L), pi_minus_three, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(4.L - 3.14159265358979323846264338327950288419716939937510L), four_minus_pi, tolerance);
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(pow((4 - 3.14159265358979323846264338327950288419716939937510L), 1.5L)), pow23_four_minus_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(pow((3.14159265358979323846264338327950288419716939937510L), 2.71828182845904523536028747135266249775724709369995L)), pi_pow_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(pow((3.14159265358979323846264338327950288419716939937510L), 0.33333333333333333333333333333333333333333333333333L)), cbrt_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(exp(-0.5L)), exp_minus_half, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(pow(2.71828182845904523536028747135266249775724709369995L, 3.14159265358979323846264338327950288419716939937510L)), e_pow_pi, tolerance);
+
+
+#else // Only double, so no suffix L.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(pow((4 - 3.14159265358979323846264338327950288419716939937510), 1.5)), pow23_four_minus_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(pow((3.14159265358979323846264338327950288419716939937510), 2.71828182845904523536028747135266249775724709369995)), pi_pow_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(pow((3.14159265358979323846264338327950288419716939937510), 0.33333333333333333333333333333333333333333333333333)), cbrt_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(exp(-0.5)), exp_minus_half, tolerance);
+#endif
+ // Rational fractions.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(0.333333333333333333333333333333333333333L), third, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(0.666666666666666666666666666666666666667L), two_thirds, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(0.75L), three_quarters, tolerance);
+ // Two and related.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(2.L)), root_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(3.L)), root_three, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(2.L)/2), half_root_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(log(2.L)), ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(log(log(2.0L))), ln_ln_two, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(log(4.0L))), root_ln_four, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(1/sqrt(2.0L)), one_div_root_two, tolerance);
+
+ // pi.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L), pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L/2), half_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L/3), third_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L/6), sixth_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(2 * 3.14159265358979323846264338327950288419716939937510L), two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3 * 3.14159265358979323846264338327950288419716939937510L / 4), three_quarters_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(4 * 3.14159265358979323846264338327950288419716939937510L / 3), four_thirds_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(1 / (2 * 3.14159265358979323846264338327950288419716939937510L)), one_div_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(3.14159265358979323846264338327950288419716939937510L)), root_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(3.14159265358979323846264338327950288419716939937510L / 2)), root_half_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(2 * 3.14159265358979323846264338327950288419716939937510L)), root_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(1 / sqrt(3.14159265358979323846264338327950288419716939937510L)), one_div_root_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(1 / sqrt(2 * 3.14159265358979323846264338327950288419716939937510L)), one_div_root_two_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(sqrt(1. / 3.14159265358979323846264338327950288419716939937510L)), root_one_div_pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L - 3.L), pi_minus_three, tolerance * 2 ); // tolerance * 2 because of cancellation loss.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(4.L - 3.14159265358979323846264338327950288419716939937510L), four_minus_pi, tolerance );
+ // BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(pow((4 - 3.14159265358979323846264338327950288419716939937510L), 1.5L)), pow23_four_minus_pi, tolerance); See above.
+ //
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(pow((3.14159265358979323846264338327950288419716939937510L), 2.71828182845904523536028747135266249775724709369995L)), pi_pow_e, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L), pi_sqr, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L/6), pi_sqr_div_six, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L), pi_cubed, tolerance); // See above.
+
+ // BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L), cbrt_pi, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(cbrt_pi * cbrt_pi * cbrt_pi, pi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION((static_cast<long double>(1)/cbrt_pi), one_div_cbrt_pi, tolerance);
+
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(6.366197723675813430755350534900574481378385829618257E-1L), two_div_pi, tolerance * 3); // 2/pi
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(7.97884560802865355879892119868763736951717262329869E-1L), root_two_div_pi, tolerance * 3); // sqrt(2/pi)
+
+ // Euler
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(2.71828182845904523536028747135266249775724709369995L), e, tolerance);
+
+ //BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(exp(-0.5L)), exp_minus_half, tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(pow(e, pi), e_pow_pi, tolerance); // See also above.
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(e), root_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log10(e), log10_e, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(1)/log10(e), one_div_log10_e, tolerance);
+
+ // Trigonmetric
+ BOOST_CHECK_CLOSE_FRACTION(pi/180, degree, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(180 / pi, radian, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sin(1.L), sin_one, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cos(1.L), cos_one, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sinh(1.L), sinh_one, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cosh(1.L), cosh_one, tolerance);
+
+ // Phi
+ BOOST_CHECK_CLOSE_FRACTION((1.L + sqrt(5.L)) /2, phi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log((1.L + sqrt(5.L)) /2), ln_phi, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1.L / log((1.L + sqrt(5.L)) /2), one_div_ln_phi, tolerance);
+
+ //Euler's Gamma
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992L, euler, tolerance); // (sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(1.L/ 0.57721566490153286060651209008240243104215933593992L, one_div_euler, tolerance); // (from sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992L * 0.57721566490153286060651209008240243104215933593992L, euler_sqr, tolerance); // (from sequence A001620 in OEIS).
+
+ // Misc
+ BOOST_CHECK_CLOSE_FRACTION(1.644934066848226436472415166646025189218949901206L, zeta_two, tolerance); // A013661 as a constant (usually base 10) in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.20205690315959428539973816151144999076498629234049888179227L, zeta_three, tolerance); // (sequence A002117 in OEIS)
+ BOOST_CHECK_CLOSE_FRACTION(.91596559417721901505460351493238411077414937428167213L, catalan, tolerance); // A006752 as a constant in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.1395470994046486574927930193898461120875997958365518247216557100852480077060706857071875468869385150L, extreme_value_skewness, tolerance); // Mathematica: N[12 Sqrt[6] Zeta[3]/Pi^3, 1101]
+ BOOST_CHECK_CLOSE_FRACTION(0.6311106578189371381918993515442277798440422031347194976580945856929268196174737254599050270325373067L, rayleigh_skewness, tolerance); // Mathematica: N[2 Sqrt[Pi] (Pi - 3)/((4 - Pi)^(3/2)), 1100]
+ BOOST_CHECK_CLOSE_FRACTION(2.450893006876380628486604106197544154e-01L, rayleigh_kurtosis_excess, tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(2.68545200106530644530971483548179569382038229399446295305115234555721885953715200280114117493184769799515L, khinchin, tolerance ); // A002210 as a constant https://oeis.org/A002210/constant
+ BOOST_CHECK_CLOSE_FRACTION(1.2824271291006226368753425688697917277676889273250011L, glaisher, tolerance ); // https://oeis.org/A074962/constant
+
+} // template <class RealType>void test_spots(RealType)
+
+template <class Policy>
+void test_real_concept_policy(const Policy&)
+{
+ // Basic sanity checks for constants using real_concept.
+ // Parameter Policy is used to control precision.
+
+ using boost::math::concepts::real_concept;
+
+ boost::math::concepts::real_concept tolerance = boost::math::tools::epsilon<real_concept>() * 2; // double
+ std::cout << "Tolerance for type " << typeid(real_concept).name() << " is " << tolerance << "." << std::endl;
+
+ //typedef typename boost::math::policies::precision<boost::math::concepts::real_concept, boost::math::policies::policy<> >::type t1;
+ // A precision of zero means we don't know what the precision of this type is until runtime.
+ //std::cout << "Precision for type " << typeid(boost::math::concepts::real_concept).name() << " is " << t1::value << "." << std::endl;
+
+ using namespace boost::math::constants;
+ BOOST_MATH_STD_USING
+
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L, (pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L), (root_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L/2), (root_half_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L * 2), (root_two_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(log(4.0L)), (root_ln_four<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(2.71828182845904523536028747135266249775724709369995L, (e<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.5, (half<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104259335L, (euler<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(2.0L), (root_two<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log(2.0L), (ln_two<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log(log(2.0L)), (ln_ln_two<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(1)/3, (third<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<long double>(2)/3, (twothirds<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.14159265358979323846264338327950288419716939937510L, (pi_minus_three<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(4.L - 3.14159265358979323846264338327950288419716939937510L, (four_minus_pi<real_concept, Policy>)(), tolerance);
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+ BOOST_CHECK_CLOSE_FRACTION(pow((4 - 3.14159265358979323846264338327950288419716939937510L), 1.5L), (pow23_four_minus_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510L), 2.71828182845904523536028747135266249775724709369995L), (pi_pow_e<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510L), 0.33333333333333333333333333333333333333333333333333L), (cbrt_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(exp(-0.5L), (exp_minus_half<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow(2.71828182845904523536028747135266249775724709369995L, 3.14159265358979323846264338327950288419716939937510L), (e_pow_pi<real_concept, Policy>)(), tolerance);
+
+
+#else // Only double, so no suffix L.
+ BOOST_CHECK_CLOSE_FRACTION(pow((4 - 3.14159265358979323846264338327950288419716939937510), 1.5), (pow23_four_minus_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510), 2.71828182845904523536028747135266249775724709369995), (pi_pow_e<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510), 0.33333333333333333333333333333333333333333333333333), (cbrt_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(exp(-0.5), (exp_minus_half<real_concept, Policy>)(), tolerance);
+#endif
+ // Rational fractions.
+ BOOST_CHECK_CLOSE_FRACTION(0.333333333333333333333333333333333333333L, (third<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.666666666666666666666666666666666666667L, (two_thirds<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(0.75L, (three_quarters<real_concept, Policy>)(), tolerance);
+ // Two and related.
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(2.L), (root_two<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.L), (root_three<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(2.L)/2, (half_root_two<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log(2.L), (ln_two<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log(log(2.0L)), (ln_ln_two<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(log(4.0L)), (root_ln_four<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1/sqrt(2.0L), (one_div_root_two<real_concept, Policy>)(), tolerance);
+
+ // pi.
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L, (pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L/2, (half_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L/3, (third_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L/6, (sixth_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(2 * 3.14159265358979323846264338327950288419716939937510L, (two_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3 * 3.14159265358979323846264338327950288419716939937510L / 4, (three_quarters_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(4 * 3.14159265358979323846264338327950288419716939937510L / 3, (four_thirds_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1 / (2 * 3.14159265358979323846264338327950288419716939937510L), (one_div_two_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L), (root_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(3.14159265358979323846264338327950288419716939937510L / 2), (root_half_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(2 * 3.14159265358979323846264338327950288419716939937510L), (root_two_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1 / sqrt(3.14159265358979323846264338327950288419716939937510L), (one_div_root_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1 / sqrt(2 * 3.14159265358979323846264338327950288419716939937510L), (one_div_root_two_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(1. / 3.14159265358979323846264338327950288419716939937510L), (root_one_div_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L - 3.L, (pi_minus_three<real_concept, Policy>)(), tolerance * 2 ); // tolerance * 2 because of cancellation loss.
+ BOOST_CHECK_CLOSE_FRACTION(4.L - 3.14159265358979323846264338327950288419716939937510L, (four_minus_pi<real_concept, Policy>)(), tolerance );
+ // BOOST_CHECK_CLOSE_FRACTION(pow((4 - 3.14159265358979323846264338327950288419716939937510L), 1.5L), (pow23_four_minus_pi<real_concept, Policy>)(), tolerance); See above.
+ //
+ BOOST_CHECK_CLOSE_FRACTION(pow((3.14159265358979323846264338327950288419716939937510L), 2.71828182845904523536028747135266249775724709369995L), (pi_pow_e<real_concept, Policy>)(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L, (pi_sqr<real_concept, Policy>)(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L/6, (pi_sqr_div_six<real_concept, Policy>)(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L, (pi_cubed<real_concept, Policy>)(), tolerance); // See above.
+
+ // BOOST_CHECK_CLOSE_FRACTION(3.14159265358979323846264338327950288419716939937510L * 3.14159265358979323846264338327950288419716939937510L, (cbrt_pi<real_concept, Policy>)(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION((cbrt_pi<real_concept, Policy>)() * (cbrt_pi<real_concept, Policy>)() * (cbrt_pi<real_concept, Policy>)(), (pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION((1)/(cbrt_pi<real_concept, Policy>)(), (one_div_cbrt_pi<real_concept, Policy>)(), tolerance);
+
+ // Euler
+ BOOST_CHECK_CLOSE_FRACTION(2.71828182845904523536028747135266249775724709369995L, (e<real_concept, Policy>)(), tolerance);
+
+ //BOOST_CHECK_CLOSE_FRACTION(exp(-0.5L), (exp_minus_half<real_concept, Policy>)(), tolerance); // See above.
+ BOOST_CHECK_CLOSE_FRACTION(pow(e<real_concept, Policy>(), (pi<real_concept, Policy>)()), (e_pow_pi<real_concept, Policy>)(), tolerance); // See also above.
+ BOOST_CHECK_CLOSE_FRACTION(sqrt(e<real_concept, Policy>()), (root_e<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log10(e<real_concept, Policy>()), (log10_e<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1/log10(e<real_concept, Policy>()), (one_div_log10_e<real_concept, Policy>)(), tolerance);
+
+ // Trigonmetric
+ BOOST_CHECK_CLOSE_FRACTION((pi<real_concept, Policy>)()/180, (degree<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(180 / (pi<real_concept, Policy>)(), (radian<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sin(1.L), (sin_one<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cos(1.L), (cos_one<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(sinh(1.L), (sinh_one<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(cosh(1.L), (cosh_one<real_concept, Policy>)(), tolerance);
+
+ // Phi
+ BOOST_CHECK_CLOSE_FRACTION((1.L + sqrt(5.L)) /2, (phi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(log((1.L + sqrt(5.L)) /2), (ln_phi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(1.L / log((1.L + sqrt(5.L)) /2), (one_div_ln_phi<real_concept, Policy>)(), tolerance);
+
+ //Euler's Gamma
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992L, (euler<real_concept, Policy>)(), tolerance); // (sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(1.L/ 0.57721566490153286060651209008240243104215933593992L, (one_div_euler<real_concept, Policy>)(), tolerance); // (from sequence A001620 in OEIS).
+ BOOST_CHECK_CLOSE_FRACTION(0.57721566490153286060651209008240243104215933593992L * 0.57721566490153286060651209008240243104215933593992L, (euler_sqr<real_concept, Policy>)(), tolerance); // (from sequence A001620 in OEIS).
+
+ // Misc
+ BOOST_CHECK_CLOSE_FRACTION(1.644934066848226436472415166646025189218949901206L, (zeta_two<real_concept, Policy>)(), tolerance); // A013661 as a constant (usually base 10) in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.20205690315959428539973816151144999076498629234049888179227L, (zeta_three<real_concept, Policy>)(), tolerance); // (sequence A002117 in OEIS)
+ BOOST_CHECK_CLOSE_FRACTION(.91596559417721901505460351493238411077414937428167213L, (catalan<real_concept, Policy>)(), tolerance); // A006752 as a constant in OEIS.
+ BOOST_CHECK_CLOSE_FRACTION(1.1395470994046486574927930193898461120875997958365518247216557100852480077060706857071875468869385150L, (extreme_value_skewness<real_concept, Policy>)(), tolerance); // Mathematica: N[12 Sqrt[6] Zeta[3]/Pi^3, 1101]
+ BOOST_CHECK_CLOSE_FRACTION(0.6311106578189371381918993515442277798440422031347194976580945856929268196174737254599050270325373067L, (rayleigh_skewness<real_concept, Policy>)(), tolerance); // Mathematica: N[2 Sqrt[Pi] (Pi - 3)/((4 - Pi)^(3/2)), 1100]
+ BOOST_CHECK_CLOSE_FRACTION(2.450893006876380628486604106197544154e-01L, (rayleigh_kurtosis_excess<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION(2.68545200106530644530971483548179569382038229399446295305115234555721885953715200280114117493184769799515L, (khinchin<real_concept, Policy>)(), tolerance ); // A002210 as a constant https://oeis.org/A002210/constant
+ BOOST_CHECK_CLOSE_FRACTION(1.2824271291006226368753425688697917277676889273250011L, (glaisher<real_concept, Policy>)(), tolerance ); // https://oeis.org/A074962/constant
+
+ //
+ // Last of all come the test cases that behave differently if we're calculating the constants on the fly:
+ //
+ if(boost::math::tools::digits<real_concept>() > boost::math::constants::max_string_digits)
+ {
+ // This suffers from cancellation error, so increased tolerance:
+ BOOST_CHECK_CLOSE_FRACTION((static_cast<real_concept>(4. - 3.14159265358979323846264338327950288419716939937510L)), (four_minus_pi<real_concept, Policy>)(), tolerance * 3);
+ BOOST_CHECK_CLOSE_FRACTION((static_cast<real_concept>(0.14159265358979323846264338327950288419716939937510L)), (pi_minus_three<real_concept, Policy>)(), tolerance * 3);
+ }
+ else
+ {
+ BOOST_CHECK_CLOSE_FRACTION((static_cast<real_concept>(4. - 3.14159265358979323846264338327950288419716939937510L)), (four_minus_pi<real_concept, Policy>)(), tolerance);
+ BOOST_CHECK_CLOSE_FRACTION((static_cast<real_concept>(0.14159265358979323846264338327950288419716939937510L)), (pi_minus_three<real_concept, Policy>)(), tolerance);
+ }
+
+} // template <class boost::math::concepts::real_concept>void test_spots(boost::math::concepts::real_concept)
+
int test_main(int, char* [])
{
// Basic sanity-check spot values.
- // (Parameter value, arbitrarily zero, only communicates the floating point type).
- test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 %
- test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 %
+ test_float_spots(); // Test float_constants, like boost::math::float_constants::pi;
+ test_double_spots(); // Test double_constants.
+ test_long_double_spots(); // Test long_double_constants.
+
+ test_real_concept_policy(real_concept_policy_1());
+ test_real_concept_policy(real_concept_policy_2()); // Increased precision forcing construction from string.
+ test_real_concept_policy(boost::math::policies::policy<>()); // Default.
+
+ // (Parameter value, arbitrarily zero, only communicates the floating-point type).
+ test_spots(0.0F); // Test float.
+ test_spots(0.0); // Test double.
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L); // Test long double.
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0582))
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
+ test_spots(boost::math::concepts::big_real_concept(0.)); // Test real concept.
#endif
#else
std::cout << "<note>The long double tests have been disabled on this platform "
@@ -80,14 +771,21 @@
Output:
-Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\test_constants.exe"
-Running 1 test case...
-*** No errors detected
-
-*/
-
-
-
+ 1 Feb 2012
+test_constants.cpp
+ test_constants.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Debug\test_constants.exe
+ Running 1 test case...
+ Tolerance for type class boost::math::concepts::real_concept is 4.44089e-016.
+ Tolerance for type class boost::math::concepts::real_concept is 4.44089e-016.
+ Tolerance for type class boost::math::concepts::real_concept is 4.44089e-016.
+ Tolerance for type float is 2.38419e-007.
+ Tolerance for type double is 4.44089e-016.
+ Tolerance for type long double is 4.44089e-016.
+ Tolerance for type class boost::math::concepts::real_concept is 4.44089e-016.
+ Tolerance for type class boost::math::concepts::big_real_concept is 1.33227e-014.
+
+ *** No errors detected
+*/
Modified: branches/release/libs/math/test/test_digamma.hpp
==============================================================================
--- branches/release/libs/math/test/test_digamma.hpp (original)
+++ branches/release/libs/math/test/test_digamma.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -12,16 +12,17 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_digamma(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -38,10 +39,10 @@
//
// test digamma against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::digamma", test_name);
std::cout << std::endl;
}
@@ -57,19 +58,19 @@
//
# include "digamma_data.ipp"
- do_test_digamma(digamma_data, name, "Digamma Function: Large Values");
+ do_test_digamma<T>(digamma_data, name, "Digamma Function: Large Values");
# include "digamma_root_data.ipp"
- do_test_digamma(digamma_root_data, name, "Digamma Function: Near the Positive Root");
+ do_test_digamma<T>(digamma_root_data, name, "Digamma Function: Near the Positive Root");
# include "digamma_small_data.ipp"
- do_test_digamma(digamma_small_data, name, "Digamma Function: Near Zero");
+ do_test_digamma<T>(digamma_small_data, name, "Digamma Function: Near Zero");
# include "digamma_neg_data.ipp"
- do_test_digamma(digamma_neg_data, name, "Digamma Function: Negative Values");
+ do_test_digamma<T>(digamma_neg_data, name, "Digamma Function: Negative Values");
}
Modified: branches/release/libs/math/test/test_ellint_1.hpp
==============================================================================
--- branches/release/libs/math/test/test_ellint_1.hpp (original)
+++ branches/release/libs/math/test/test_ellint_1.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -17,16 +17,17 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_f(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
@@ -37,10 +38,10 @@
#endif
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp2, 1, 0),
- extract_result(2));
+ bind_func<Real>(fp2, 1, 0),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_1", test);
@@ -48,11 +49,11 @@
}
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_k(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing: " << test << std::endl;
@@ -62,10 +63,10 @@
#else
value_type (*fp1)(value_type) = boost::math::ellint_1;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0),
- extract_result(1));
+ bind_func<Real>(fp1, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_1", test);
@@ -84,10 +85,10 @@
{{ SC_(-4), SC_(0.875), SC_(-5.3190556182262405182189463092940736859067548232647) }},
{{ SC_(8), SC_(-0.625), SC_(9.0419973860310100524448893214394562615252527557062) }},
{{ SC_(1e-05), SC_(0.875), SC_(0.000010000000000127604166668510945638036143355898993088) }},
- {{ SC_(1e+05), SC_(10)/1024, SC_(100002.38431454899771096037307519328741455615271038) }},
+ {{ SC_(1e+05), T(10)/1024, SC_(100002.38431454899771096037307519328741455615271038) }},
{{ SC_(1e-20), SC_(1), SC_(1.0000000000000000000000000000000000000000166666667e-20) }},
{{ SC_(1e-20), SC_(1e-20), SC_(1.000000000000000e-20) }},
- {{ SC_(1e+20), SC_(400)/1024, SC_(1.0418143796499216839719289963154558027005142709763e20) }},
+ {{ SC_(1e+20), T(400)/1024, SC_(1.0418143796499216839719289963154558027005142709763e20) }},
{{ SC_(1e+50), SC_(0.875), SC_(1.3913251718238765549409892714295358043696028445944e50) }},
{{ SC_(2), SC_(0.5), SC_(2.1765877052210673672479877957388515321497888026770) }},
{{ SC_(4), SC_(0.5), SC_(4.2543274975235836861894752787874633017836785640477) }},
@@ -99,11 +100,11 @@
{{ SC_(-10), SC_(0.5), SC_(-10.697409951222544858346795279378531495869386960090) }},
}};
- do_test_ellint_f(data1, type_name, "Elliptic Integral F: Mathworld Data");
+ do_test_ellint_f<T>(data1, type_name, "Elliptic Integral F: Mathworld Data");
#include "ellint_f_data.ipp"
- do_test_ellint_f(ellint_f_data, type_name, "Elliptic Integral F: Random Data");
+ do_test_ellint_f<T>(ellint_f_data, type_name, "Elliptic Integral F: Random Data");
// Function values calculated on http://functions.wolfram.com/
// Note that Mathematica's EllipticK accepts k^2 as the second parameter.
@@ -111,18 +112,18 @@
{{ SC_(0), SC_(1.5707963267948966192313216916397514420985846996876) }},
{{ SC_(0.125), SC_(1.5769867712158131421244030532288080803822271060839) }},
{{ SC_(0.25), SC_(1.5962422221317835101489690714979498795055744578951) }},
- {{ SC_(300)/1024, SC_(1.6062331054696636704261124078746600894998873503208) }},
- {{ SC_(400)/1024, SC_(1.6364782007562008756208066125715722889067992997614) }},
+ {{ T(300)/1024, SC_(1.6062331054696636704261124078746600894998873503208) }},
+ {{ T(400)/1024, SC_(1.6364782007562008756208066125715722889067992997614) }},
{{ SC_(-0.5), SC_(1.6857503548125960428712036577990769895008008941411) }},
{{ SC_(-0.75), SC_(1.9109897807518291965531482187613425592531451316788) }},
- {{ 1-SC_(1)/8, SC_(2.185488469278223686913080323730158689730428415766) }},
- {{ 1-SC_(1)/1024, SC_(4.5074135978990422666372495313621124487894807327687) }},
+ {{ 1-T(1)/8, SC_(2.185488469278223686913080323730158689730428415766) }},
+ {{ 1-T(1)/1024, SC_(4.5074135978990422666372495313621124487894807327687) }},
}};
- do_test_ellint_k(data2, type_name, "Elliptic Integral K: Mathworld Data");
+ do_test_ellint_k<T>(data2, type_name, "Elliptic Integral K: Mathworld Data");
#include "ellint_k_data.ipp"
- do_test_ellint_k(ellint_k_data, type_name, "Elliptic Integral K: Random Data");
+ do_test_ellint_k<T>(ellint_k_data, type_name, "Elliptic Integral K: Random Data");
}
Modified: branches/release/libs/math/test/test_ellint_2.hpp
==============================================================================
--- branches/release/libs/math/test/test_ellint_2.hpp (original)
+++ branches/release/libs/math/test/test_ellint_2.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -17,16 +17,17 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_e2(const T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
@@ -37,21 +38,21 @@
#endif
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp2, 1, 0),
- extract_result(2));
+ bind_func<Real>(fp2, 1, 0),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_2", test);
std::cout << std::endl;
}
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_e1(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing: " << test << std::endl;
@@ -61,10 +62,10 @@
#else
value_type (*fp1)(value_type) = boost::math::ellint_2;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0),
- extract_result(1));
+ bind_func<Real>(fp1, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_2", test);
@@ -80,40 +81,40 @@
{{ SC_(0), SC_(0), SC_(0) }},
{{ SC_(-10), SC_(0), SC_(-10) }},
{{ SC_(-1), SC_(-1), SC_(-0.84147098480789650665250232163029899962256306079837) }},
- {{ SC_(-4), SC_(900) / 1024, SC_(-3.1756145986492562317862928524528520686391383168377) }},
- {{ SC_(8), SC_(-600) / 1024, SC_(7.2473147180505693037677015377802777959345489333465) }},
- {{ SC_(1e-05), SC_(800) / 1024, SC_(9.999999999898274739584436515967055859383969942432E-6) }},
- {{ SC_(1e+05), SC_(100) / 1024, SC_(99761.153306972066658135668386691227343323331995888) }},
+ {{ SC_(-4), T(900) / 1024, SC_(-3.1756145986492562317862928524528520686391383168377) }},
+ {{ SC_(8), T(-600) / 1024, SC_(7.2473147180505693037677015377802777959345489333465) }},
+ {{ SC_(1e-05), T(800) / 1024, SC_(9.999999999898274739584436515967055859383969942432E-6) }},
+ {{ SC_(1e+05), T(100) / 1024, SC_(99761.153306972066658135668386691227343323331995888) }},
{{ SC_(1e+10), SC_(-0.5), SC_(9.3421545766487137036576748555295222252286528414669e9) }},
- {{ static_cast<T>(ldexp(SC_(1), 66)), SC_(400) / 1024, SC_(7.0886102721911705466476846969992069994308167515242e19) }},
- {{ static_cast<T>(ldexp(SC_(1), 166)), SC_(900) / 1024, SC_(7.1259011068364515942912094521783688927118026465790e49) }},
+ {{ static_cast<T>(ldexp(T(1), 66)), T(400) / 1024, SC_(7.0886102721911705466476846969992069994308167515242e19) }},
+ {{ static_cast<T>(ldexp(T(1), 166)), T(900) / 1024, SC_(7.1259011068364515942912094521783688927118026465790e49) }},
}};
- do_test_ellint_e2(data1, type_name, "Elliptic Integral E: Mathworld Data");
+ do_test_ellint_e2<T>(data1, type_name, "Elliptic Integral E: Mathworld Data");
#include "ellint_e2_data.ipp"
- do_test_ellint_e2(ellint_e2_data, type_name, "Elliptic Integral E: Random Data");
+ do_test_ellint_e2<T>(ellint_e2_data, type_name, "Elliptic Integral E: Random Data");
// Function values calculated on http://functions.wolfram.com/
// Note that Mathematica's EllipticE accepts k^2 as the second parameter.
static const boost::array<boost::array<T, 2>, 10> data2 = {{
{{ SC_(-1), SC_(1) }},
{{ SC_(0), SC_(1.5707963267948966192313216916397514420985846996876) }},
- {{ SC_(100) / 1024, SC_(1.5670445330545086723323795143598956428788609133377) }},
- {{ SC_(200) / 1024, SC_(1.5557071588766556854463404816624361127847775545087) }},
- {{ SC_(300) / 1024, SC_(1.5365278991162754883035625322482669608948678755743) }},
- {{ SC_(400) / 1024, SC_(1.5090417763083482272165682786143770446401437564021) }},
+ {{ T(100) / 1024, SC_(1.5670445330545086723323795143598956428788609133377) }},
+ {{ T(200) / 1024, SC_(1.5557071588766556854463404816624361127847775545087) }},
+ {{ T(300) / 1024, SC_(1.5365278991162754883035625322482669608948678755743) }},
+ {{ T(400) / 1024, SC_(1.5090417763083482272165682786143770446401437564021) }},
{{ SC_(-0.5), SC_(1.4674622093394271554597952669909161360253617523272) }},
- {{ SC_(-600) / 1024, SC_(1.4257538571071297192428217218834579920545946473778) }},
- {{ SC_(-800) / 1024, SC_(1.2927868476159125056958680222998765985004489572909) }},
- {{ SC_(-900) / 1024, SC_(1.1966864890248739524112920627353824133420353430982) }},
+ {{ T(-600) / 1024, SC_(1.4257538571071297192428217218834579920545946473778) }},
+ {{ T(-800) / 1024, SC_(1.2927868476159125056958680222998765985004489572909) }},
+ {{ T(-900) / 1024, SC_(1.1966864890248739524112920627353824133420353430982) }},
}};
- do_test_ellint_e1(data2, type_name, "Elliptic Integral E: Mathworld Data");
+ do_test_ellint_e1<T>(data2, type_name, "Elliptic Integral E: Mathworld Data");
#include "ellint_e_data.ipp"
- do_test_ellint_e1(ellint_e_data, type_name, "Elliptic Integral E: Random Data");
+ do_test_ellint_e1<T>(ellint_e_data, type_name, "Elliptic Integral E: Random Data");
}
Modified: branches/release/libs/math/test/test_ellint_3.hpp
==============================================================================
--- branches/release/libs/math/test/test_ellint_3.hpp (original)
+++ branches/release/libs/math/test/test_ellint_3.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -17,17 +17,18 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_pi3(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
@@ -38,10 +39,10 @@
#endif
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp2, 2, 0, 1),
- extract_result(3));
+ bind_func<Real>(fp2, 2, 0, 1),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_3", test);
@@ -49,11 +50,11 @@
}
-template <typename T>
+template <class Real, typename T>
void do_test_ellint_pi2(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
@@ -64,10 +65,10 @@
#endif
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp2, 1, 0),
- extract_result(2));
+ bind_func<Real>(fp2, 1, 0),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_3", test);
@@ -91,31 +92,31 @@
{{ SC_(0.75), SC_(0.75), SC_(0), SC_(0.871827580412760575085768367421866079353646112288567703061975) }},
{{ SC_(1), SC_(0.25), SC_(0), SC_(0.255341921221036266504482236490473678204201638800822621740476) }},
{{ SC_(2), SC_(0.25), SC_(0), SC_(0.261119051639220165094943572468224137699644963125853641716219) }},
- {{ SC_(1023)/1024, SC_(1.5), SC_(0), SC_(13.2821612239764190363647953338544569682942329604483733197131) }},
+ {{ T(1023)/1024, SC_(1.5), SC_(0), SC_(13.2821612239764190363647953338544569682942329604483733197131) }},
{{ SC_(0.5), SC_(-1), SC_(0.5), SC_(-1.228014414316220642611298946293865487807) }},
{{ SC_(0.5), SC_(1e+10), SC_(0.5), SC_(1.536591003599172091573590441336982730551e+10) }},
{{ SC_(-1e+05), SC_(10), SC_(0.75), SC_(0.0347926099493147087821620459290460547131012904008557007934290) }},
{{ SC_(-1e+10), SC_(10), SC_(0.875), SC_(0.000109956202759561502329123384755016959364346382187364656768212) }},
{{ SC_(-1e+10), SC_(1e+20), SC_(0.875), SC_(1.00000626665567332602765201107198822183913978895904937646809e15) }},
- {{ SC_(-1e+10), SC_(1608)/1024, SC_(0.875), SC_(0.0000157080616044072676127333183571107873332593142625043567690379) }},
- {{ 1-SC_(1) / 1024, SC_(1e+20), SC_(0.875), SC_(6.43274293944380717581167058274600202023334985100499739678963e21) }},
+ {{ SC_(-1e+10), T(1608)/1024, SC_(0.875), SC_(0.0000157080616044072676127333183571107873332593142625043567690379) }},
+ {{ 1-T(1) / 1024, SC_(1e+20), SC_(0.875), SC_(6.43274293944380717581167058274600202023334985100499739678963e21) }},
{{ SC_(50), SC_(0.125), SC_(0.25), SC_(0.196321043776719739372196642514913879497104766409504746018939) }},
{{ SC_(1.125), SC_(1), SC_(0.25), SC_(1.77299767784815770192352979665283069318388205110727241629752) }},
{{ SC_(1.125), SC_(10), SC_(0.25), SC_(0.662467818678976949597336360256848770217429434745967677192487) }},
{{ SC_(1.125), SC_(3), SC_(0.25), SC_(-0.142697285116693775525461312178015106079842313950476205580178) }},
- {{ SC_(257)/256, SC_(1.5), SC_(0.125), SC_(22.2699300473528164111357290313578126108398839810535700884237) }},
- {{ SC_(257)/256, SC_(21.5), SC_(0.125), SC_(-0.535406081652313940727588125663856894154526187713506526799429) }},
+ {{ T(257)/256, SC_(1.5), SC_(0.125), SC_(22.2699300473528164111357290313578126108398839810535700884237) }},
+ {{ T(257)/256, SC_(21.5), SC_(0.125), SC_(-0.535406081652313940727588125663856894154526187713506526799429) }},
}};
- do_test_ellint_pi3(data1, type_name, "Elliptic Integral PI: Mathworld Data");
+ do_test_ellint_pi3<T>(data1, type_name, "Elliptic Integral PI: Mathworld Data");
#include "ellint_pi3_data.ipp"
- do_test_ellint_pi3(ellint_pi3_data, type_name, "Elliptic Integral PI: Random Data");
+ do_test_ellint_pi3<T>(ellint_pi3_data, type_name, "Elliptic Integral PI: Random Data");
#include "ellint_pi3_large_data.ipp"
- do_test_ellint_pi3(ellint_pi3_large_data, type_name, "Elliptic Integral PI: Large Random Data");
+ do_test_ellint_pi3<T>(ellint_pi3_large_data, type_name, "Elliptic Integral PI: Large Random Data");
// function values calculated on http://functions.wolfram.com/
static const boost::array<boost::array<T, 3>, 9> data2 = {{
@@ -126,15 +127,15 @@
{{ SC_(-4), SC_(0.3), SC_(0.712708870925620061597924858162260293305195624270730660081949) }},
{{ SC_(-1e+05), SC_(-0.5), SC_(0.00496944596485066055800109163256108604615568144080386919012831) }},
{{ SC_(-1e+10), SC_(-0.75), SC_(0.0000157080225184890546939710019277357161497407143903832703317801) }},
- {{ SC_(1) / 1024, SC_(-0.875), SC_(2.18674503176462374414944618968850352696579451638002110619287) }},
- {{ SC_(1023)/1024, SC_(-0.875), SC_(101.045289804941384100960063898569538919135722087486350366997) }},
+ {{ T(1) / 1024, SC_(-0.875), SC_(2.18674503176462374414944618968850352696579451638002110619287) }},
+ {{ T(1023)/1024, SC_(-0.875), SC_(101.045289804941384100960063898569538919135722087486350366997) }},
}};
- do_test_ellint_pi2(data2, type_name, "Complete Elliptic Integral PI: Mathworld Data");
+ do_test_ellint_pi2<T>(data2, type_name, "Complete Elliptic Integral PI: Mathworld Data");
#include "ellint_pi2_data.ipp"
- do_test_ellint_pi2(ellint_pi2_data, type_name, "Complete Elliptic Integral PI: Random Data");
+ do_test_ellint_pi2<T>(ellint_pi2_data, type_name, "Complete Elliptic Integral PI: Random Data");
// Special cases, exceptions etc:
BOOST_CHECK_THROW(boost::math::ellint_3(T(1.0001), T(-1), T(0)), std::domain_error);
Modified: branches/release/libs/math/test/test_erf.hpp
==============================================================================
--- branches/release/libs/math/test/test_erf.hpp (original)
+++ branches/release/libs/math/test/test_erf.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -15,16 +15,17 @@
#include "test_erf_hooks.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_erf(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -41,18 +42,18 @@
//
// test erf against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::erf;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erf");
}
#endif
@@ -64,29 +65,29 @@
#else
funcp = boost::math::erfc;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(2));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erfc", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::erfc;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind(funcp, 0),
- extract_result(2));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erfc");
}
#endif
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_erf_inv(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type);
@@ -101,19 +102,19 @@
#else
pg funcp = boost::math::erf_inv;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf_inv", test_name);
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_erfc_inv(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -133,10 +134,10 @@
#else
funcp = boost::math::erfc_inv;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erfc_inv", test_name);
std::cout << std::endl;
}
@@ -152,29 +153,29 @@
//
# include "erf_small_data.ipp"
- do_test_erf(erf_small_data, name, "Erf Function: Small Values");
+ do_test_erf<T>(erf_small_data, name, "Erf Function: Small Values");
# include "erf_data.ipp"
- do_test_erf(erf_data, name, "Erf Function: Medium Values");
+ do_test_erf<T>(erf_data, name, "Erf Function: Medium Values");
# include "erf_large_data.ipp"
- do_test_erf(erf_large_data, name, "Erf Function: Large Values");
+ do_test_erf<T>(erf_large_data, name, "Erf Function: Large Values");
# include "erf_inv_data.ipp"
- do_test_erf_inv(erf_inv_data, name, "Inverse Erf Function");
+ do_test_erf_inv<T>(erf_inv_data, name, "Inverse Erf Function");
# include "erfc_inv_data.ipp"
- do_test_erfc_inv(erfc_inv_data, name, "Inverse Erfc Function");
+ do_test_erfc_inv<T>(erfc_inv_data, name, "Inverse Erfc Function");
# include "erfc_inv_big_data.ipp"
if(std::numeric_limits<T>::min_exponent <= -4500)
{
- do_test_erfc_inv(erfc_inv_big_data, name, "Inverse Erfc Function: extreme values");
+ do_test_erfc_inv<T>(erfc_inv_big_data, name, "Inverse Erfc Function: extreme values");
}
}
Modified: branches/release/libs/math/test/test_expint.cpp
==============================================================================
--- branches/release/libs/math/test/test_expint.cpp (original)
+++ branches/release/libs/math/test/test_expint.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -67,7 +67,7 @@
".*", // compiler
".*", // stdlib
"Mac OS", // platform
- "float|double|long double", // test type(s)
+ "float|double|long double|real_concept", // test type(s)
".*Ei.*", // test data group
".*", 300, 200); // test function
add_expected_result(
@@ -103,19 +103,12 @@
".*", 150, 50); // test function
}
add_expected_result(
- "Sun.*", // compiler
- ".*", // stdlib
- ".*", // platform
- "real_concept", // test type(s)
- ".*Ei.*", // test data group
- ".*", 150, 50); // test function
- add_expected_result(
".*", // compiler
".*", // stdlib
".*", // platform
"real_concept", // test type(s)
".*Ei.*", // test data group
- ".*", 50, 20); // test function
+ ".*", 150, 50); // test function
add_expected_result(
".*", // compiler
".*", // stdlib
@@ -139,7 +132,9 @@
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L, "long double");
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
+#endif
#else
std::cout << "<note>The long double tests have been disabled on this platform "
"either because the long double overloads of the usual math functions are "
@@ -151,7 +146,9 @@
test_expint(0.1, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_expint(0.1L, "long double");
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_expint(boost::math::concepts::real_concept(0.1), "real_concept");
+#endif
#else
std::cout << "<note>The long double tests have been disabled on this platform "
"either because the long double overloads of the usual math functions are "
@@ -161,3 +158,4 @@
return 0;
}
+
Modified: branches/release/libs/math/test/test_expint.hpp
==============================================================================
--- branches/release/libs/math/test/test_expint.hpp (original)
+++ branches/release/libs/math/test/test_expint.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -17,9 +17,10 @@
#include "handle_test_result.hpp"
#include "test_expint_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
template <class T>
@@ -37,7 +38,7 @@
boost::math::itrunc(n), z);
}
#endif
-template <class T>
+template <class Real, class T>
void do_test_expint(const T& data, const char* type_name, const char* test_name)
{
//
@@ -45,7 +46,7 @@
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -60,10 +61,10 @@
//
// test expint against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::expint", test_name);
#ifdef TEST_OTHER
if(boost::is_floating_point<value_type>::value && other::expint(2u, 2.0))
@@ -72,17 +73,17 @@
//
// test expint against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "other::expint", test_name);
}
#endif
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_expint_Ei(const T& data, const char* type_name, const char* test_name)
{
//
@@ -90,7 +91,7 @@
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -105,10 +106,10 @@
//
// test expint against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::expint", test_name);
#ifdef TEST_OTHER
if(boost::is_floating_point<value_type>::value && other::expint(2.0))
@@ -117,10 +118,10 @@
//
// test expint against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "other::expint", test_name);
}
#endif
@@ -133,24 +134,24 @@
// The actual test data is rather verbose, so it's in a separate file
//
#include "expint_data.ipp"
- do_test_expint(expint_data, name, "Exponential Integral En");
+ do_test_expint<T>(expint_data, name, "Exponential Integral En");
#include "expint_small_data.ipp"
- do_test_expint(expint_small_data, name, "Exponential Integral En: small z values");
+ do_test_expint<T>(expint_small_data, name, "Exponential Integral En: small z values");
#include "expint_1_data.ipp"
- do_test_expint(expint_1_data, name, "Exponential Integral E1");
+ do_test_expint<T>(expint_1_data, name, "Exponential Integral E1");
#include "expinti_data.ipp"
- do_test_expint_Ei(expinti_data, name, "Exponential Integral Ei");
+ do_test_expint_Ei<T>(expinti_data, name, "Exponential Integral Ei");
if(boost::math::tools::log_max_value<T>() > 100)
{
#include "expinti_data_double.ipp"
- do_test_expint_Ei(expinti_data_double, name, "Exponential Integral Ei: double exponent range");
+ do_test_expint_Ei<T>(expinti_data_double, name, "Exponential Integral Ei: double exponent range");
}
#if (defined(LDBL_MAX_10_EXP) && (LDBL_MAX_10_EXP > 2000)) || defined(TEST_UDT)
if(boost::math::tools::log_max_value<T>() > 1000)
{
#include "expinti_data_long.ipp"
- do_test_expint_Ei(expinti_data_long, name, "Exponential Integral Ei: long exponent range");
+ do_test_expint_Ei<T>(expinti_data_long, name, "Exponential Integral Ei: long exponent range");
}
#endif
}
Modified: branches/release/libs/math/test/test_gamma.cpp
==============================================================================
--- branches/release/libs/math/test/test_gamma.cpp (original)
+++ branches/release/libs/math/test/test_gamma.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -60,7 +60,30 @@
largest_type, // test type(s)
"factorials", // test data group
"boost::math::tgamma", 100, 15); // test function
-
+ //
+ // G++ On Win32:
+ //
+ add_expected_result(
+ "GNU.*", // compiler
+ ".*", // stdlib
+ "Win32.*", // platform
+ largest_type, // test type(s)
+ "factorials", // test data group
+ "boost::math::tgamma", 100, 15); // test function
+ add_expected_result(
+ "GNU.*", // compiler
+ ".*", // stdlib
+ "Win32.*", // platform
+ "real_concept", // test type(s)
+ "factorials", // test data group
+ "boost::math::tgamma", 200, 100); // test function
+ add_expected_result(
+ "GNU.*", // compiler
+ ".*", // stdlib
+ "Win32.*", // platform
+ "real_concept", // test type(s)
+ "near.*", // test data group
+ "boost::math::tgamma", 200, 60); // test function
//
// G++ on Linux, result vary a bit by processor type,
// on Itanium results are *much* better than listed here,
Modified: branches/release/libs/math/test/test_gamma.hpp
==============================================================================
--- branches/release/libs/math/test/test_gamma.hpp (original)
+++ branches/release/libs/math/test/test_gamma.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -19,16 +19,17 @@
#include "test_gamma_hooks.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_gamma(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -45,18 +46,18 @@
//
// test tgamma against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::tgamma;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::tgamma");
}
#endif
@@ -68,18 +69,18 @@
#else
funcp = boost::math::lgamma;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(2));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::lgamma", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::lgamma;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(2));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::lgamma");
}
#endif
@@ -87,11 +88,11 @@
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_gammap1m1(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -108,10 +109,10 @@
//
// test tgamma1pm1 against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma1pm1", test_name);
std::cout << std::endl;
}
@@ -151,17 +152,17 @@
//
# include "test_gamma_data.ipp"
- do_test_gamma(factorials, name, "factorials");
- do_test_gamma(near_0, name, "near 0");
- do_test_gamma(near_1, name, "near 1");
- do_test_gamma(near_2, name, "near 2");
- do_test_gamma(near_m10, name, "near -10");
- do_test_gamma(near_m55, name, "near -55");
+ do_test_gamma<T>(factorials, name, "factorials");
+ do_test_gamma<T>(near_0, name, "near 0");
+ do_test_gamma<T>(near_1, name, "near 1");
+ do_test_gamma<T>(near_2, name, "near 2");
+ do_test_gamma<T>(near_m10, name, "near -10");
+ do_test_gamma<T>(near_m55, name, "near -55");
//
// And now tgamma1pm1 which computes gamma(1+dz)-1:
//
- do_test_gammap1m1(gammap1m1_data, name, "tgamma1pm1(dz)");
+ do_test_gammap1m1<T>(gammap1m1_data, name, "tgamma1pm1(dz)");
}
template <class T>
Modified: branches/release/libs/math/test/test_gamma_data.ipp
==============================================================================
--- branches/release/libs/math/test/test_gamma_data.ipp (original)
+++ branches/release/libs/math/test/test_gamma_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 198> factorials = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 198> factorials = { {
{{ SC_(1), SC_(1), SC_(0) }},
{{ SC_(2), SC_(1), SC_(0) }},
{{ SC_(3), SC_(2), SC_(0.6931471805599453094172321214581765680755) }},
@@ -205,7 +205,7 @@
} };
- static const boost::array<boost::array<T, 3>, 41> near_1 = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 41> near_1 = { {
{{ SC_(0.5), SC_(1.772453850905516027298167483341145182798), SC_(0.5723649429247000870717136756765293558236) }},
{{ SC_(0.625), SC_(1.434518848090556775636019739456423136632), SC_(0.3608294954889401811849576858227794878574) }},
{{ SC_(0.75), SC_(1.225416702465177645129098303362890526851), SC_(0.2032809514312953714814329718624296997597) }},
@@ -249,7 +249,7 @@
{{ SC_(1.5), SC_(0.8862269254527580136490837416705725913988), SC_(-0.1207822376352452223455184457816472122519) }}
} };
- static const boost::array<boost::array<T, 3>, 41> near_2 = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 41> near_2 = { {
{{ SC_(1.5), SC_(0.8862269254527580136490837416705725913988), SC_(-0.1207822376352452223455184457816472122519) }},
{{ SC_(1.625), SC_(0.8965742800565979847725123371602644603951), SC_(-0.1091741337567953724659793453255625768435) }},
{{ SC_(1.75), SC_(0.9190625268488832338468237275221678951384), SC_(-0.08440112102048555595778603413139773174384) }},
@@ -293,7 +293,7 @@
{{ SC_(2.5), SC_(1.329340388179137020473625612505858887098), SC_(0.2846828704729191596324946696827019243201) }}
} };
- static const boost::array<boost::array<T, 3>, 40> near_0 = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 40> near_0 = { {
{{ SC_(-0.5), SC_(-3.544907701811032054596334966682290365595), SC_(1.265512123484645396488945797134705923899) }},
{{ SC_(-0.375), SC_(-3.825383594908151401696052638550461697686), SC_(1.341658748500666418041408813274783487436) }},
{{ SC_(-0.25), SC_(-4.901666809860710580516393213451562107405), SC_(1.589575312551185990315897214778782835911) }},
@@ -336,7 +336,7 @@
{{ SC_(0.5), SC_(1.772453850905516027298167483341145182798), SC_(0.5723649429247000870717136756765293558236) }}
} };
- static const boost::array<boost::array<T, 3>, 40> near_m10 = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 40> near_m10 = { {
{{ SC_(-10.5), SC_(-0.2640121820547716316246385325311240439682e-6), SC_(-15.14727059071784114610117639552631963436) }},
{{ SC_(-10.375), SC_(-0.3853824777091100016167565620752110328498e-6), SC_(-14.76902954720701012688042720516103787762) }},
{{ SC_(-10.25), SC_(-0.67808180432946731304891004492754985848e-6), SC_(-14.20399790093109065161116876070387206737) }},
@@ -379,7 +379,7 @@
{{ SC_(-9.5), SC_(0.2772127911575102132058704591576802461667e-5), SC_(-12.79589533355436345901781053661879076815) }}
} };
- static const boost::array<boost::array<T, 3>, 40> near_m55 = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 40> near_m55 = { {
{{ SC_(-55.5), SC_(0.3313939247684676728377268347296671102738e-73), SC_(-169.1931592947433577934436950412776436064) }},
{{ SC_(-55.375), SC_(0.5931885913251829148011431845907438457576e-73), SC_(-168.6109546898941580979033836431457031234) }},
{{ SC_(-55.25), SC_(0.128134265213561204650151776242601279892e-72), SC_(-167.8408033134133338381597995376176917559) }},
@@ -422,7 +422,7 @@
{{ SC_(-54.5), SC_(-0.183923628246499558424938393274965246202e-71), SC_(-165.1767762739909689670975862547818473059) }}
} };
- static const boost::array<boost::array<T, 2>, 141> gammap1m1_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 141> gammap1m1_data = { {
{{ SC_(-0.4952165186405181884765625), SC_(0.7559827693907095754807809442951050489732) }},
{{ SC_(-0.4642883241176605224609375), SC_(0.6574328869566978138139138799311066062094) }},
{{ SC_(-0.4024595916271209716796875), SC_(0.4948624198600628575485791492257182331098) }},
Modified: branches/release/libs/math/test/test_gamma_dist.cpp
==============================================================================
--- branches/release/libs/math/test/test_gamma_dist.cpp (original)
+++ branches/release/libs/math/test/test_gamma_dist.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -223,7 +223,7 @@
test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 %
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L); // Test long double.
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
#else
Modified: branches/release/libs/math/test/test_hermite.hpp
==============================================================================
--- branches/release/libs/math/test/test_hermite.hpp (original)
+++ branches/release/libs/math/test/test_hermite.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -21,16 +21,17 @@
#include "handle_test_result.hpp"
#include "test_legendre_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_hermite(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(unsigned, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -49,10 +50,10 @@
//
// test hermite against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int1(funcp, 0, 1),
- extract_result(2));
+ bind_func_int1<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::hermite", test_name);
std::cout << std::endl;
@@ -69,7 +70,7 @@
//
# include "hermite.ipp"
- do_test_hermite(hermite, name, "Hermite Polynomials");
+ do_test_hermite<T>(hermite, name, "Hermite Polynomials");
}
template <class T>
Modified: branches/release/libs/math/test/test_hypergeometric_dist.cpp
==============================================================================
--- branches/release/libs/math/test/test_hypergeometric_dist.cpp (original)
+++ branches/release/libs/math/test/test_hypergeometric_dist.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -24,6 +24,7 @@
#include <boost/array.hpp>
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#define BOOST_CHECK_EX(a) \
{\
@@ -136,7 +137,7 @@
return cdf(complement(d, x));
}
-template <class T>
+template <class Real, class T>
void do_test_hypergeometric(const T& data, const char* type_name, const char* test_name)
{
// warning suppression:
@@ -146,7 +147,7 @@
#if !defined(TEST_QUANT) || (TEST_QUANT == 0)
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type, value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -163,10 +164,10 @@
//
// test hypergeometric against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2, 3),
- extract_result(4));
+ bind_func<Real>(funcp, 0, 1, 2, 3),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "hypergeometric PDF", test_name);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -178,10 +179,10 @@
//
// test hypergeometric against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2, 3),
- extract_result(5));
+ bind_func<Real>(funcp, 0, 1, 2, 3),
+ extract_result<Real>(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "hypergeometric CDF", test_name);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -193,20 +194,20 @@
//
// test hypergeometric against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2, 3),
- extract_result(6));
+ bind_func<Real>(funcp, 0, 1, 2, 3),
+ extract_result<Real>(6));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "hypergeometric CDF complement", test_name);
std::cout << std::endl;
#endif
}
-template <class T>
+template <class Real, class T>
void do_test_hypergeometric_quantile(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Checking quantiles with " << test_name << " with type " << type_name
<< "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
@@ -419,7 +420,7 @@
// Test data taken from Mathematica 6
#define T RealType
#include "hypergeometric_test_data.ipp"
- do_test_hypergeometric(hypergeometric_test_data, type_name, "Mathematica data");
+ do_test_hypergeometric<T>(hypergeometric_test_data, type_name, "Mathematica data");
#include "hypergeometric_dist_data2.ipp"
if(boost::is_floating_point<RealType>::value)
@@ -427,16 +428,16 @@
//
// Don't test this for real_concept: it's too slow!!!
//
- do_test_hypergeometric(hypergeometric_dist_data2, type_name, "Random large data");
+ do_test_hypergeometric<T>(hypergeometric_dist_data2, type_name, "Random large data");
}
- do_test_hypergeometric_quantile(hypergeometric_test_data, type_name, "Mathematica data");
+ do_test_hypergeometric_quantile<T>(hypergeometric_test_data, type_name, "Mathematica data");
if(boost::is_floating_point<RealType>::value)
{
//
// Don't test this for real_concept: it's too slow!!!
//
- do_test_hypergeometric_quantile(hypergeometric_dist_data2, type_name, "Random large data");
+ do_test_hypergeometric_quantile<T>(hypergeometric_dist_data2, type_name, "Random large data");
}
RealType tolerance = (std::max)(
@@ -485,7 +486,9 @@
test_spots(0.0, "double"); // Test double. OK at decdigits 7, tolerance = 1e07 %
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L, "long double"); // Test long double.
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_spots(boost::math::concepts::real_concept(0), "real_concept"); // Test real_concept.
+#endif
#else
std::cout << "<note>The long double tests have been disabled on this platform "
"either because the long double overloads of the usual math functions are "
Modified: branches/release/libs/math/test/test_ibeta.cpp
==============================================================================
--- branches/release/libs/math/test/test_ibeta.cpp (original)
+++ branches/release/libs/math/test/test_ibeta.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -182,16 +182,23 @@
// MinGW:
//
add_expected_result(
- "[^|]*mingw[^|]*", // compiler
+ "GNU[^|]*", // compiler
"[^|]*", // stdlib
- ".*", // platform
+ "Win32[^|]*", // platform
+ "real_concept", // test type(s)
+ "(?i).*medium.*", // test data group
+ ".*", 400, 50); // test function
+ add_expected_result(
+ "GNU.*", // compiler
+ ".*", // stdlib
+ "Win32.*", // platform
"double", // test type(s)
"(?i).*large.*", // test data group
".*", 20, 10); // test function
add_expected_result(
- "[^|]*mingw[^|]*", // compiler
- "[^|]*", // stdlib
- ".*", // platform
+ "GNU.*", // compiler
+ ".*", // stdlib
+ "Win32.*", // platform
largest_type, // test type(s)
"(?i).*large.*", // test data group
".*", 200000, 10000); // test function
Modified: branches/release/libs/math/test/test_ibeta.hpp
==============================================================================
--- branches/release/libs/math/test/test_ibeta.hpp (original)
+++ branches/release/libs/math/test/test_ibeta.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -17,16 +17,17 @@
#include "test_beta_hooks.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_beta(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -43,10 +44,10 @@
//
// test beta against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(3));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::beta", test_name);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -54,10 +55,10 @@
#else
funcp = boost::math::betac;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(4));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::betac", test_name);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -65,10 +66,10 @@
#else
funcp = boost::math::ibeta;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(5));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta", test_name);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -76,18 +77,18 @@
#else
funcp = boost::math::ibetac;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(6));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(6));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::ibeta;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(5));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(5));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::ibeta");
}
#endif
@@ -106,25 +107,25 @@
#if !defined(TEST_DATA) || (TEST_DATA == 1)
# include "ibeta_small_data.ipp"
- do_test_beta(ibeta_small_data, name, "Incomplete Beta Function: Small Values");
+ do_test_beta<T>(ibeta_small_data, name, "Incomplete Beta Function: Small Values");
#endif
#if !defined(TEST_DATA) || (TEST_DATA == 2)
# include "ibeta_data.ipp"
- do_test_beta(ibeta_data, name, "Incomplete Beta Function: Medium Values");
+ do_test_beta<T>(ibeta_data, name, "Incomplete Beta Function: Medium Values");
#endif
#if !defined(TEST_DATA) || (TEST_DATA == 3)
# include "ibeta_large_data.ipp"
- do_test_beta(ibeta_large_data, name, "Incomplete Beta Function: Large and Diverse Values");
+ do_test_beta<T>(ibeta_large_data, name, "Incomplete Beta Function: Large and Diverse Values");
#endif
#if !defined(TEST_DATA) || (TEST_DATA == 4)
# include "ibeta_int_data.ipp"
- do_test_beta(ibeta_int_data, name, "Incomplete Beta Function: Small Integer Values");
+ do_test_beta<T>(ibeta_int_data, name, "Incomplete Beta Function: Small Integer Values");
#endif
}
Modified: branches/release/libs/math/test/test_ibeta_inv.cpp
==============================================================================
--- branches/release/libs/math/test/test_ibeta_inv.cpp (original)
+++ branches/release/libs/math/test/test_ibeta_inv.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -105,16 +105,16 @@
// causes more extreme test cases to be executed:
//
add_expected_result(
- ".*mingw.*", // compiler
+ "GNU.*", // compiler
".*", // stdlib
- ".*", // platform
+ "Win32.*", // platform
"double", // test type(s)
".*", // test data group
".*", 10, 10); // test function
add_expected_result(
- ".*mingw.*", // compiler
+ "GNU.*", // compiler
".*", // stdlib
- ".*", // platform
+ "Win32.*", // platform
largest_type, // test type(s)
".*", // test data group
".*", 300000, 20000); // test function
Modified: branches/release/libs/math/test/test_ibeta_inv.hpp
==============================================================================
--- branches/release/libs/math/test/test_ibeta_inv.hpp (original)
+++ branches/release/libs/math/test/test_ibeta_inv.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -17,17 +17,18 @@
#include "test_beta_hooks.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void test_inverses(const T& data)
{
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::policies::digits<value_type, boost::math::policies::policy<> >()/2)) * 100;
if(boost::math::policies::digits<value_type, boost::math::policies::policy<> >() < 50)
@@ -41,37 +42,37 @@
// information left in the value we're using as input to the inverse
// to be able to get back to the original value.
//
- if(data[i][5] == 0)
- BOOST_CHECK_EQUAL(boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]), value_type(0));
- else if((1 - data[i][5] > 0.001)
- && (fabs(data[i][5]) > 2 * boost::math::tools::min_value<value_type>())
- && (fabs(data[i][5]) > 2 * boost::math::tools::min_value<double>()))
+ if(Real(data[i][5]) == 0)
+ BOOST_CHECK_EQUAL(boost::math::ibeta_inv(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(0));
+ else if((1 - Real(data[i][5]) > 0.001)
+ && (fabs(Real(data[i][5])) > 2 * boost::math::tools::min_value<value_type>())
+ && (fabs(Real(data[i][5])) > 2 * boost::math::tools::min_value<double>()))
{
- value_type inv = boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]);
- BOOST_CHECK_CLOSE(data[i][2], inv, precision);
+ value_type inv = boost::math::ibeta_inv(Real(data[i][0]), Real(data[i][1]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE(Real(data[i][2]), inv, precision);
}
- else if(1 == data[i][5])
- BOOST_CHECK_EQUAL(boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]), value_type(1));
+ else if(1 == Real(data[i][5]))
+ BOOST_CHECK_EQUAL(boost::math::ibeta_inv(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(1));
- if(data[i][6] == 0)
- BOOST_CHECK_EQUAL(boost::math::ibetac_inv(data[i][0], data[i][1], data[i][6]), value_type(1));
- else if((1 - data[i][6] > 0.001)
- && (fabs(data[i][6]) > 2 * boost::math::tools::min_value<value_type>())
- && (fabs(data[i][6]) > 2 * boost::math::tools::min_value<double>()))
+ if(Real(data[i][6]) == 0)
+ BOOST_CHECK_EQUAL(boost::math::ibetac_inv(Real(data[i][0]), Real(data[i][1]), Real(data[i][6])), value_type(1));
+ else if((1 - Real(data[i][6]) > 0.001)
+ && (fabs(Real(data[i][6])) > 2 * boost::math::tools::min_value<value_type>())
+ && (fabs(Real(data[i][6])) > 2 * boost::math::tools::min_value<double>()))
{
- value_type inv = boost::math::ibetac_inv(data[i][0], data[i][1], data[i][6]);
- BOOST_CHECK_CLOSE(data[i][2], inv, precision);
+ value_type inv = boost::math::ibetac_inv(Real(data[i][0]), Real(data[i][1]), Real(data[i][6]));
+ BOOST_CHECK_CLOSE(Real(data[i][2]), inv, precision);
}
- else if(data[i][6] == 1)
- BOOST_CHECK_EQUAL(boost::math::ibetac_inv(data[i][0], data[i][1], data[i][6]), value_type(0));
+ else if(Real(data[i][6]) == 1)
+ BOOST_CHECK_EQUAL(boost::math::ibetac_inv(Real(data[i][0]), Real(data[i][1]), Real(data[i][6])), value_type(0));
}
}
-template <class T>
+template <class Real, class T>
void test_inverses2(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -88,10 +89,10 @@
//
// test ibeta_inv(T, T, T) against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(3));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta_inv", test_name);
//
// test ibetac_inv(T, T, T) against data:
@@ -101,10 +102,10 @@
#else
funcp = boost::math::ibetac_inv;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(4));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_inv", test_name);
}
@@ -122,25 +123,25 @@
#if !defined(TEST_DATA) || (TEST_DATA == 1)
# include "ibeta_small_data.ipp"
- test_inverses(ibeta_small_data);
+ test_inverses<T>(ibeta_small_data);
#endif
#if !defined(TEST_DATA) || (TEST_DATA == 2)
# include "ibeta_data.ipp"
- test_inverses(ibeta_data);
+ test_inverses<T>(ibeta_data);
#endif
#if !defined(TEST_DATA) || (TEST_DATA == 3)
# include "ibeta_large_data.ipp"
- test_inverses(ibeta_large_data);
+ test_inverses<T>(ibeta_large_data);
#endif
#if !defined(TEST_DATA) || (TEST_DATA == 4)
# include "ibeta_inv_data.ipp"
- test_inverses2(ibeta_inv_data, name, "Inverse incomplete beta");
+ test_inverses2<T>(ibeta_inv_data, name, "Inverse incomplete beta");
#endif
}
Modified: branches/release/libs/math/test/test_ibeta_inv_ab.hpp
==============================================================================
--- branches/release/libs/math/test/test_ibeta_inv_ab.hpp (original)
+++ branches/release/libs/math/test/test_ibeta_inv_ab.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -23,17 +23,18 @@
#endif
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void test_inverses(const T& data)
{
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::policies::digits<value_type, boost::math::policies::policy<> >()/2)) * 100;
if(boost::math::policies::digits<value_type, boost::math::policies::policy<> >() < 50)
@@ -47,53 +48,53 @@
// information left in the value we're using as input to the inverse
// to be able to get back to the original value.
//
- if(data[i][5] == 0)
+ if(Real(data[i][5]) == 0)
{
- BOOST_CHECK_EQUAL(boost::math::ibeta_inva(data[i][1], data[i][2], data[i][5]), boost::math::tools::max_value<value_type>());
- BOOST_CHECK_EQUAL(boost::math::ibeta_invb(data[i][0], data[i][2], data[i][5]), boost::math::tools::min_value<value_type>());
+ BOOST_CHECK_EQUAL(boost::math::ibeta_inva(Real(data[i][1]), Real(data[i][2]), Real(data[i][5])), boost::math::tools::max_value<value_type>());
+ BOOST_CHECK_EQUAL(boost::math::ibeta_invb(Real(data[i][0]), Real(data[i][2]), Real(data[i][5])), boost::math::tools::min_value<value_type>());
}
- else if((1 - data[i][5] > 0.001)
- && (fabs(data[i][5]) > 2 * boost::math::tools::min_value<value_type>())
- && (fabs(data[i][5]) > 2 * boost::math::tools::min_value<double>()))
+ else if((1 - Real(data[i][5]) > 0.001)
+ && (fabs(Real(data[i][5])) > 2 * boost::math::tools::min_value<value_type>())
+ && (fabs(Real(data[i][5])) > 2 * boost::math::tools::min_value<double>()))
{
- value_type inv = boost::math::ibeta_inva(data[i][1], data[i][2], data[i][5]);
- BOOST_CHECK_CLOSE(data[i][0], inv, precision);
- inv = boost::math::ibeta_invb(data[i][0], data[i][2], data[i][5]);
- BOOST_CHECK_CLOSE(data[i][1], inv, precision);
+ value_type inv = boost::math::ibeta_inva(Real(data[i][1]), Real(data[i][2]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE(Real(data[i][0]), inv, precision);
+ inv = boost::math::ibeta_invb(Real(data[i][0]), Real(data[i][2]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE(Real(data[i][1]), inv, precision);
}
- else if(1 == data[i][5])
+ else if(1 == Real(data[i][5]))
{
- BOOST_CHECK_EQUAL(boost::math::ibeta_inva(data[i][1], data[i][2], data[i][5]), boost::math::tools::min_value<value_type>());
- BOOST_CHECK_EQUAL(boost::math::ibeta_invb(data[i][0], data[i][2], data[i][5]), boost::math::tools::max_value<value_type>());
+ BOOST_CHECK_EQUAL(boost::math::ibeta_inva(Real(data[i][1]), Real(data[i][2]), Real(data[i][5])), boost::math::tools::min_value<value_type>());
+ BOOST_CHECK_EQUAL(boost::math::ibeta_invb(Real(data[i][0]), Real(data[i][2]), Real(data[i][5])), boost::math::tools::max_value<value_type>());
}
- if(data[i][6] == 0)
+ if(Real(data[i][6]) == 0)
{
- BOOST_CHECK_EQUAL(boost::math::ibetac_inva(data[i][1], data[i][2], data[i][6]), boost::math::tools::min_value<value_type>());
- BOOST_CHECK_EQUAL(boost::math::ibetac_invb(data[i][0], data[i][2], data[i][6]), boost::math::tools::max_value<value_type>());
+ BOOST_CHECK_EQUAL(boost::math::ibetac_inva(Real(data[i][1]), Real(data[i][2]), Real(data[i][6])), boost::math::tools::min_value<value_type>());
+ BOOST_CHECK_EQUAL(boost::math::ibetac_invb(Real(data[i][0]), Real(data[i][2]), Real(data[i][6])), boost::math::tools::max_value<value_type>());
}
- else if((1 - data[i][6] > 0.001)
- && (fabs(data[i][6]) > 2 * boost::math::tools::min_value<value_type>())
- && (fabs(data[i][6]) > 2 * boost::math::tools::min_value<double>()))
+ else if((1 - Real(data[i][6]) > 0.001)
+ && (fabs(Real(data[i][6])) > 2 * boost::math::tools::min_value<value_type>())
+ && (fabs(Real(data[i][6])) > 2 * boost::math::tools::min_value<double>()))
{
- value_type inv = boost::math::ibetac_inva(data[i][1], data[i][2], data[i][6]);
- BOOST_CHECK_CLOSE(data[i][0], inv, precision);
- inv = boost::math::ibetac_invb(data[i][0], data[i][2], data[i][6]);
- BOOST_CHECK_CLOSE(data[i][1], inv, precision);
+ value_type inv = boost::math::ibetac_inva(Real(data[i][1]), Real(data[i][2]), Real(data[i][6]));
+ BOOST_CHECK_CLOSE(Real(data[i][0]), inv, precision);
+ inv = boost::math::ibetac_invb(Real(data[i][0]), Real(data[i][2]), Real(data[i][6]));
+ BOOST_CHECK_CLOSE(Real(data[i][1]), inv, precision);
}
- else if(data[i][6] == 1)
+ else if(Real(data[i][6]) == 1)
{
- BOOST_CHECK_EQUAL(boost::math::ibetac_inva(data[i][1], data[i][2], data[i][6]), boost::math::tools::max_value<value_type>());
- BOOST_CHECK_EQUAL(boost::math::ibetac_invb(data[i][0], data[i][2], data[i][6]), boost::math::tools::min_value<value_type>());
+ BOOST_CHECK_EQUAL(boost::math::ibetac_inva(Real(data[i][1]), Real(data[i][2]), Real(data[i][6])), boost::math::tools::max_value<value_type>());
+ BOOST_CHECK_EQUAL(boost::math::ibetac_invb(Real(data[i][0]), Real(data[i][2]), Real(data[i][6])), boost::math::tools::min_value<value_type>());
}
}
}
-template <class T>
+template <class Real, class T>
void test_inverses2(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -110,10 +111,10 @@
//
// test ibeta_inva(T, T, T) against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(3));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta_inva", test_name);
//
// test ibetac_inva(T, T, T) against data:
@@ -123,10 +124,10 @@
#else
funcp = boost::math::ibetac_inva;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(4));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_inva", test_name);
//
// test ibeta_invb(T, T, T) against data:
@@ -136,10 +137,10 @@
#else
funcp = boost::math::ibeta_invb;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(5));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta_invb", test_name);
//
// test ibetac_invb(T, T, T) against data:
@@ -149,10 +150,10 @@
#else
funcp = boost::math::ibetac_invb;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1, 2),
- extract_result(6));
+ bind_func<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(6));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_invb", test_name);
}
@@ -170,19 +171,19 @@
#if !defined(TEST_DATA) || (TEST_DATA == 1)
# include "ibeta_small_data.ipp"
- test_inverses(ibeta_small_data);
+ test_inverses<T>(ibeta_small_data);
#endif
#if !defined(TEST_DATA) || (TEST_DATA == 2)
# include "ibeta_data.ipp"
- test_inverses(ibeta_data);
+ test_inverses<T>(ibeta_data);
#endif
#if !defined(TEST_DATA) || (TEST_DATA == 3)
# include "ibeta_large_data.ipp"
- test_inverses(ibeta_large_data);
+ test_inverses<T>(ibeta_large_data);
#endif
#if !defined(TEST_REAL_CONCEPT) || defined(FULL_TEST) || (TEST_DATA == 4)
@@ -197,7 +198,7 @@
//
# include "ibeta_inva_data.ipp"
- test_inverses2(ibeta_inva_data, name, "Inverse incomplete beta");
+ test_inverses2<T>(ibeta_inva_data, name, "Inverse incomplete beta");
#ifndef FULL_TEST
}
#endif
Modified: branches/release/libs/math/test/test_igamma.cpp
==============================================================================
--- branches/release/libs/math/test/test_igamma.cpp (original)
+++ branches/release/libs/math/test/test_igamma.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -195,6 +195,38 @@
"[^|]*", 100, 50); // test function
//
+ // Minw:
+ //
+ add_expected_result(
+ "GNU[^|]*", // compiler
+ "[^|]*", // stdlib
+ "Win32[^|]*", // platform
+ largest_type, // test type(s)
+ "[^|]*medium[^|]*", // test data group
+ "[^|]*", 200, 100); // test function
+ add_expected_result(
+ "GNU[^|]*", // compiler
+ "[^|]*", // stdlib
+ "Win32[^|]*", // platform
+ largest_type, // test type(s)
+ "[^|]*small[^|]*", // test data group
+ "[^|]*", 100, 50); // test function
+ add_expected_result(
+ "GNU[^|]*", // compiler
+ "[^|]*", // stdlib
+ "Win32[^|]*", // platform
+ "real_concept", // test type(s)
+ "[^|]*medium[^|]*", // test data group
+ "[^|]*", 400, 100); // test function
+ add_expected_result(
+ "GNU[^|]*", // compiler
+ "[^|]*", // stdlib
+ "Win32[^|]*", // platform
+ "real_concept", // test type(s)
+ "[^|]*integer[^|]*", // test data group
+ ".*", 80, 50); // test function
+
+ //
// Large exponent range causes more extreme test cases to be evaluated:
//
if(std::numeric_limits<long double>::max_exponent > std::numeric_limits<double>::max_exponent)
@@ -302,7 +334,7 @@
test_spots(0.0);
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L);
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_spots(boost::math::concepts::real_concept(0.1));
#endif
#endif
Modified: branches/release/libs/math/test/test_igamma.hpp
==============================================================================
--- branches/release/libs/math/test/test_igamma.hpp (original)
+++ branches/release/libs/math/test/test_igamma.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -19,16 +19,17 @@
#include "test_gamma_hooks.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_gamma_2(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -45,12 +46,12 @@
//
// test tgamma(T, T) against data:
//
- if(data[0][2] > 0)
+ if(Real(data[0][2]) > 0)
{
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma", test_name);
//
// test tgamma_lower(T, T) against data:
@@ -60,10 +61,10 @@
#else
funcp = boost::math::tgamma_lower;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(4));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_lower", test_name);
}
//
@@ -74,10 +75,10 @@
#else
funcp = boost::math::gamma_q;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(3));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_q", test_name);
#if defined(TEST_OTHER)
//
@@ -86,10 +87,10 @@
if(boost::is_floating_point<value_type>::value)
{
funcp = other::gamma_q;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(3));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(3));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_q");
}
#endif
@@ -101,10 +102,10 @@
#else
funcp = boost::math::gamma_p;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(5));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_p", test_name);
#if defined(TEST_OTHER)
//
@@ -113,10 +114,10 @@
if(boost::is_floating_point<value_type>::value)
{
funcp = other::gamma_p;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(5));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(5));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_p");
}
#endif
@@ -137,19 +138,19 @@
//
# include "igamma_med_data.ipp"
- do_test_gamma_2(igamma_med_data, name, "tgamma(a, z) medium values");
+ do_test_gamma_2<T>(igamma_med_data, name, "tgamma(a, z) medium values");
# include "igamma_small_data.ipp"
- do_test_gamma_2(igamma_small_data, name, "tgamma(a, z) small values");
+ do_test_gamma_2<T>(igamma_small_data, name, "tgamma(a, z) small values");
# include "igamma_big_data.ipp"
- do_test_gamma_2(igamma_big_data, name, "tgamma(a, z) large values");
+ do_test_gamma_2<T>(igamma_big_data, name, "tgamma(a, z) large values");
# include "igamma_int_data.ipp"
- do_test_gamma_2(igamma_int_data, name, "tgamma(a, z) integer and half integer values");
+ do_test_gamma_2<T>(igamma_int_data, name, "tgamma(a, z) integer and half integer values");
}
template <class T>
Modified: branches/release/libs/math/test/test_igamma_inv.hpp
==============================================================================
--- branches/release/libs/math/test/test_igamma_inv.hpp (original)
+++ branches/release/libs/math/test/test_igamma_inv.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -19,9 +19,10 @@
#include "test_gamma_hooks.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
#define BOOST_CHECK_CLOSE_EX(a, b, prec, i) \
@@ -37,7 +38,7 @@
}\
}
-template <class T>
+template <class Real, class T>
void do_test_gamma_2(const T& data, const char* type_name, const char* test_name)
{
//
@@ -45,7 +46,7 @@
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -72,50 +73,50 @@
// information left in the value we're using as input to the inverse
// to be able to get back to the original value.
//
- if(data[i][5] == 0)
- BOOST_CHECK_EQUAL(boost::math::gamma_p_inv(data[i][0], data[i][5]), value_type(0));
- else if((1 - data[i][5] > 0.001)
- && (fabs(data[i][5]) > 2 * boost::math::tools::min_value<value_type>())
- && (fabs(data[i][5]) > 2 * boost::math::tools::min_value<double>()))
+ if(Real(data[i][5]) == 0)
+ BOOST_CHECK_EQUAL(boost::math::gamma_p_inv(Real(data[i][0]), Real(data[i][5])), value_type(0));
+ else if((1 - Real(data[i][5]) > 0.001)
+ && (fabs(Real(data[i][5])) > 2 * boost::math::tools::min_value<value_type>())
+ && (fabs(Real(data[i][5])) > 2 * boost::math::tools::min_value<double>()))
{
- value_type inv = boost::math::gamma_p_inv(data[i][0], data[i][5]);
- BOOST_CHECK_CLOSE_EX(data[i][1], inv, precision, i);
+ value_type inv = boost::math::gamma_p_inv(Real(data[i][0]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][1]), inv, precision, i);
}
- else if(1 == data[i][5])
- BOOST_CHECK_EQUAL(boost::math::gamma_p_inv(data[i][0], data[i][5]), boost::math::tools::max_value<value_type>());
+ else if(1 == Real(data[i][5]))
+ BOOST_CHECK_EQUAL(boost::math::gamma_p_inv(Real(data[i][0]), Real(data[i][5])), boost::math::tools::max_value<value_type>());
else
{
// not enough bits in our input to get back to x, but we should be in
// the same ball park:
- value_type inv = boost::math::gamma_p_inv(data[i][0], data[i][5]);
- BOOST_CHECK_CLOSE_EX(data[i][1], inv, 100000, i);
+ value_type inv = boost::math::gamma_p_inv(Real(data[i][0]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][1]), inv, 100000, i);
}
- if(data[i][3] == 0)
- BOOST_CHECK_EQUAL(boost::math::gamma_q_inv(data[i][0], data[i][3]), boost::math::tools::max_value<value_type>());
- else if((1 - data[i][3] > 0.001) && (fabs(data[i][3]) > 2 * boost::math::tools::min_value<value_type>()))
+ if(Real(data[i][3]) == 0)
+ BOOST_CHECK_EQUAL(boost::math::gamma_q_inv(Real(data[i][0]), Real(data[i][3])), boost::math::tools::max_value<value_type>());
+ else if((1 - Real(data[i][3]) > 0.001) && (fabs(Real(data[i][3])) > 2 * boost::math::tools::min_value<value_type>()))
{
- value_type inv = boost::math::gamma_q_inv(data[i][0], data[i][3]);
- BOOST_CHECK_CLOSE_EX(data[i][1], inv, precision, i);
+ value_type inv = boost::math::gamma_q_inv(Real(data[i][0]), Real(data[i][3]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][1]), inv, precision, i);
}
- else if(1 == data[i][3])
- BOOST_CHECK_EQUAL(boost::math::gamma_q_inv(data[i][0], data[i][3]), value_type(0));
- else if(fabs(data[i][3]) > 2 * boost::math::tools::min_value<value_type>())
+ else if(1 == Real(data[i][3]))
+ BOOST_CHECK_EQUAL(boost::math::gamma_q_inv(Real(data[i][0]), Real(data[i][3])), value_type(0));
+ else if(fabs(Real(data[i][3])) > 2 * boost::math::tools::min_value<value_type>())
{
// not enough bits in our input to get back to x, but we should be in
// the same ball park:
- value_type inv = boost::math::gamma_q_inv(data[i][0], data[i][3]);
- BOOST_CHECK_CLOSE_EX(data[i][1], inv, 100, i);
+ value_type inv = boost::math::gamma_q_inv(Real(data[i][0]), Real(data[i][3]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][1]), inv, 100, i);
}
}
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_gamma_inv(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -132,10 +133,10 @@
//
// test gamma_p_inv(T, T) against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_p_inv", test_name);
//
// test gamma_q_inv(T, T) against data:
@@ -145,10 +146,10 @@
#else
funcp = boost::math::gamma_q_inv;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(3));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_q_inv", test_name);
#ifdef TEST_OTHER
if(boost::is_floating_point<value_type>::value)
@@ -157,19 +158,19 @@
//
// test gamma_p_inv(T, T) against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_q");
//
// test gamma_q_inv(T, T) against data:
//
funcp = other::gamma_q_inv;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(3));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(3));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_q");
}
#endif
@@ -190,29 +191,29 @@
//
# include "igamma_med_data.ipp"
- do_test_gamma_2(igamma_med_data, name, "Running round trip sanity checks on incomplete gamma medium sized values");
+ do_test_gamma_2<T>(igamma_med_data, name, "Running round trip sanity checks on incomplete gamma medium sized values");
# include "igamma_small_data.ipp"
- do_test_gamma_2(igamma_small_data, name, "Running round trip sanity checks on incomplete gamma small values");
+ do_test_gamma_2<T>(igamma_small_data, name, "Running round trip sanity checks on incomplete gamma small values");
# include "igamma_big_data.ipp"
- do_test_gamma_2(igamma_big_data, name, "Running round trip sanity checks on incomplete gamma large values");
+ do_test_gamma_2<T>(igamma_big_data, name, "Running round trip sanity checks on incomplete gamma large values");
#endif
# include "gamma_inv_data.ipp"
- do_test_gamma_inv(gamma_inv_data, name, "incomplete gamma inverse(a, z) medium values");
+ do_test_gamma_inv<T>(gamma_inv_data, name, "incomplete gamma inverse(a, z) medium values");
# include "gamma_inv_big_data.ipp"
- do_test_gamma_inv(gamma_inv_big_data, name, "incomplete gamma inverse(a, z) large values");
+ do_test_gamma_inv<T>(gamma_inv_big_data, name, "incomplete gamma inverse(a, z) large values");
# include "gamma_inv_small_data.ipp"
- do_test_gamma_inv(gamma_inv_small_data, name, "incomplete gamma inverse(a, z) small values");
+ do_test_gamma_inv<T>(gamma_inv_small_data, name, "incomplete gamma inverse(a, z) small values");
}
template <class T>
Modified: branches/release/libs/math/test/test_igamma_inva.hpp
==============================================================================
--- branches/release/libs/math/test/test_igamma_inva.hpp (original)
+++ branches/release/libs/math/test/test_igamma_inva.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -18,11 +18,11 @@
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#include "functor.hpp"
-
+#include "table_type.hpp"
#include "handle_test_result.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
#define BOOST_CHECK_CLOSE_EX(a, b, prec, i) \
@@ -38,7 +38,7 @@
}\
}
-template <class T>
+template <class Real, class T>
void do_test_gamma_2(const T& data, const char* type_name, const char* test_name)
{
//
@@ -46,7 +46,7 @@
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -73,50 +73,50 @@
// information left in the value we're using as input to the inverse
// to be able to get back to the original value.
//
- if(data[i][5] == 0)
- BOOST_CHECK_EQUAL(boost::math::gamma_p_inva(data[i][1], data[i][5]), boost::math::tools::max_value<value_type>());
- else if((1 - data[i][5] > 0.001) && (fabs(data[i][5]) > 2 * boost::math::tools::min_value<value_type>()))
+ if(Real(data[i][5]) == 0)
+ BOOST_CHECK_EQUAL(boost::math::gamma_p_inva(Real(data[i][1]), Real(data[i][5])), boost::math::tools::max_value<value_type>());
+ else if((1 - Real(data[i][5]) > 0.001) && (fabs(Real(data[i][5])) > 2 * boost::math::tools::min_value<value_type>()))
{
- value_type inv = boost::math::gamma_p_inva(data[i][1], data[i][5]);
- BOOST_CHECK_CLOSE_EX(data[i][0], inv, precision, i);
+ value_type inv = boost::math::gamma_p_inva(Real(data[i][1]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][0]), inv, precision, i);
}
- else if(1 == data[i][5])
- BOOST_CHECK_EQUAL(boost::math::gamma_p_inva(data[i][1], data[i][5]), boost::math::tools::min_value<value_type>());
- else if(data[i][5] > 2 * boost::math::tools::min_value<value_type>())
+ else if(1 == Real(data[i][5]))
+ BOOST_CHECK_EQUAL(boost::math::gamma_p_inva(Real(data[i][1]), Real(data[i][5])), boost::math::tools::min_value<value_type>());
+ else if(Real(data[i][5]) > 2 * boost::math::tools::min_value<value_type>())
{
// not enough bits in our input to get back to x, but we should be in
// the same ball park:
- value_type inv = boost::math::gamma_p_inva(data[i][1], data[i][5]);
- BOOST_CHECK_CLOSE_EX(data[i][0], inv, 100, i);
+ value_type inv = boost::math::gamma_p_inva(Real(data[i][1]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][0]), inv, 100, i);
}
- if(data[i][3] == 0)
- BOOST_CHECK_EQUAL(boost::math::gamma_q_inva(data[i][1], data[i][3]), boost::math::tools::min_value<value_type>());
- else if((1 - data[i][3] > 0.001)
- && (fabs(data[i][3]) > 2 * boost::math::tools::min_value<value_type>())
- && (fabs(data[i][3]) > 2 * boost::math::tools::min_value<double>()))
+ if(Real(data[i][3]) == 0)
+ BOOST_CHECK_EQUAL(boost::math::gamma_q_inva(Real(data[i][1]), Real(data[i][3])), boost::math::tools::min_value<value_type>());
+ else if((1 - Real(data[i][3]) > 0.001)
+ && (fabs(Real(data[i][3])) > 2 * boost::math::tools::min_value<value_type>())
+ && (fabs(Real(data[i][3])) > 2 * boost::math::tools::min_value<double>()))
{
- value_type inv = boost::math::gamma_q_inva(data[i][1], data[i][3]);
- BOOST_CHECK_CLOSE_EX(data[i][0], inv, precision, i);
+ value_type inv = boost::math::gamma_q_inva(Real(data[i][1]), Real(data[i][3]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][0]), inv, precision, i);
}
- else if(1 == data[i][3])
- BOOST_CHECK_EQUAL(boost::math::gamma_q_inva(data[i][1], data[i][3]), boost::math::tools::max_value<value_type>());
- else if(data[i][3] > 2 * boost::math::tools::min_value<value_type>())
+ else if(1 == Real(data[i][3]))
+ BOOST_CHECK_EQUAL(boost::math::gamma_q_inva(Real(data[i][1]), Real(data[i][3])), boost::math::tools::max_value<value_type>());
+ else if(Real(data[i][3]) > 2 * boost::math::tools::min_value<value_type>())
{
// not enough bits in our input to get back to x, but we should be in
// the same ball park:
- value_type inv = boost::math::gamma_q_inva(data[i][1], data[i][3]);
- BOOST_CHECK_CLOSE_EX(data[i][0], inv, 100, i);
+ value_type inv = boost::math::gamma_q_inva(Real(data[i][1]), Real(data[i][3]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][0]), inv, 100, i);
}
}
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_gamma_inva(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -133,10 +133,10 @@
//
// test gamma_p_inva(T, T) against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_p_inva", test_name);
//
// test gamma_q_inva(T, T) against data:
@@ -146,10 +146,10 @@
#else
funcp = boost::math::gamma_q_inva;
#endif
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(3));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_q_inva", test_name);
}
@@ -168,20 +168,20 @@
//
# include "igamma_med_data.ipp"
- do_test_gamma_2(igamma_med_data, name, "Running round trip sanity checks on incomplete gamma medium sized values");
+ do_test_gamma_2<T>(igamma_med_data, name, "Running round trip sanity checks on incomplete gamma medium sized values");
# include "igamma_small_data.ipp"
- do_test_gamma_2(igamma_small_data, name, "Running round trip sanity checks on incomplete gamma small values");
+ do_test_gamma_2<T>(igamma_small_data, name, "Running round trip sanity checks on incomplete gamma small values");
# include "igamma_big_data.ipp"
- do_test_gamma_2(igamma_big_data, name, "Running round trip sanity checks on incomplete gamma large values");
+ do_test_gamma_2<T>(igamma_big_data, name, "Running round trip sanity checks on incomplete gamma large values");
#endif
# include "igamma_inva_data.ipp"
- do_test_gamma_inva(igamma_inva_data, name, "Incomplete gamma inverses.");
+ do_test_gamma_inva<T>(igamma_inva_data, name, "Incomplete gamma inverses.");
}
Modified: branches/release/libs/math/test/test_instantiate1.cpp
==============================================================================
--- branches/release/libs/math/test/test_instantiate1.cpp (original)
+++ branches/release/libs/math/test/test_instantiate1.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,6 +3,8 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+#define TEST_COMPLEX
+
#include "compile_test/instantiate.hpp"
extern void other_test();
Modified: branches/release/libs/math/test/test_instantiate2.cpp
==============================================================================
--- branches/release/libs/math/test/test_instantiate2.cpp (original)
+++ branches/release/libs/math/test/test_instantiate2.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,6 +3,8 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+#define TEST_COMPLEX
+
#include "compile_test/instantiate.hpp"
void other_test()
Modified: branches/release/libs/math/test/test_inv_hyp.cpp
==============================================================================
--- branches/release/libs/math/test/test_inv_hyp.cpp (original)
+++ branches/release/libs/math/test/test_inv_hyp.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -19,6 +19,7 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
//
// DESCRIPTION:
@@ -88,7 +89,7 @@
<< BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_asinh(const T& data, const char* type_name, const char* test_name)
{
//
@@ -96,7 +97,7 @@
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -111,15 +112,15 @@
//
// test asinh against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::asinh", test_name);
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_acosh(const T& data, const char* type_name, const char* test_name)
{
//
@@ -127,7 +128,7 @@
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -142,15 +143,15 @@
//
// test acosh against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::acosh", test_name);
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_atanh(const T& data, const char* type_name, const char* test_name)
{
//
@@ -158,7 +159,7 @@
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -173,10 +174,10 @@
//
// test atanh against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::atanh", test_name);
std::cout << std::endl;
}
@@ -185,8 +186,8 @@
void test_inv_hyperbolics(T, const char* name)
{
// function values calculated on http://functions.wolfram.com/
- #define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 2>, 16> data1 = {{
+ #define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 16> data1 = {{
{{ SC_(1), SC_(0) }},
{{ SC_(18014398509481985.0)/SC_(18014398509481984.0), (SC_(18014398509481985.0)/SC_(18014398509481984.0) == 1 ? 0 : SC_(1.05367121277235078980001569764860129317209081216314559121044e-8)) }},
{{ SC_(140737488355329.0)/SC_(140737488355328.0), (SC_(140737488355329.0)/SC_(140737488355328.0) == 1 ? 0 : SC_(1.19209289550781179413921062141751258430803882725295121500042e-7)) }},
@@ -210,12 +211,12 @@
// The actual test data is rather verbose, so it's in a separate file
//
#include "asinh_data.ipp"
- do_test_asinh(asinh_data, name, "asinh");
+ do_test_asinh<T>(asinh_data, name, "asinh");
#include "acosh_data.ipp"
- do_test_acosh(data1, name, "acosh: Mathworld Data");
- do_test_acosh(acosh_data, name, "acosh");
+ do_test_acosh<T>(data1, name, "acosh: Mathworld Data");
+ do_test_acosh<T>(acosh_data, name, "acosh");
#include "atanh_data.ipp"
- do_test_atanh(atanh_data, name, "atanh");
+ do_test_atanh<T>(atanh_data, name, "atanh");
}
extern "C" double zetac(double);
@@ -258,7 +259,9 @@
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L, "long double");
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
+#endif
#else
std::cout << "<note>The long double tests have been disabled on this platform "
"either because the long double overloads of the usual math functions are "
@@ -270,7 +273,9 @@
test_inv_hyperbolics(0.1, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_inv_hyperbolics(0.1L, "long double");
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_inv_hyperbolics(boost::math::concepts::real_concept(0.1), "real_concept");
+#endif
#else
std::cout << "<note>The long double tests have been disabled on this platform "
"either because the long double overloads of the usual math functions are "
Modified: branches/release/libs/math/test/test_inverse_chi_squared_distribution.cpp
==============================================================================
--- branches/release/libs/math/test/test_inverse_chi_squared_distribution.cpp (original)
+++ branches/release/libs/math/test/test_inverse_chi_squared_distribution.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -191,7 +191,7 @@
BOOST_CHECK_CLOSE_FRACTION(variance(dist10), static_cast<RealType>(0.0052083333333333333333333333333333333333333333333333L), tol_2eps);
BOOST_CHECK_CLOSE_FRACTION(mode(dist10), static_cast<RealType>(0.08333333333333333333333333333333333333333333333L), tol_2eps);
BOOST_CHECK_CLOSE_FRACTION(median(dist10), static_cast<RealType>(0.10704554778227709530244586234274024205738435512468L), tol_2eps);
- BOOST_CHECK_CLOSE_FRACTION(cdf(dist10, median(dist10)), static_cast<RealType>(0.5L), tol_2eps);
+ BOOST_CHECK_CLOSE_FRACTION(cdf(dist10, median(dist10)), static_cast<RealType>(0.5L), 4 * tol_2eps);
BOOST_CHECK_CLOSE_FRACTION(skewness(dist10), static_cast<RealType>(3.4641016151377545870548926830117447338856105076208L), tol_2eps);
BOOST_CHECK_CLOSE_FRACTION(kurtosis(dist10), static_cast<RealType>(45), tol_2eps);
BOOST_CHECK_CLOSE_FRACTION(kurtosis_excess(dist10), static_cast<RealType>(45-3), tol_2eps);
Modified: branches/release/libs/math/test/test_inverse_gamma_distribution.cpp
==============================================================================
--- branches/release/libs/math/test/test_inverse_gamma_distribution.cpp (original)
+++ branches/release/libs/math/test/test_inverse_gamma_distribution.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -402,7 +402,7 @@
test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 %
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L); // Test long double.
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
#else
Modified: branches/release/libs/math/test/test_inverse_gaussian.cpp
==============================================================================
--- branches/release/libs/math/test/test_inverse_gaussian.cpp (original)
+++ branches/release/libs/math/test/test_inverse_gaussian.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -344,7 +344,7 @@
test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 %
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L); // Test long double.
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
#else
Modified: branches/release/libs/math/test/test_laguerre.cpp
==============================================================================
--- branches/release/libs/math/test/test_laguerre.cpp (original)
+++ branches/release/libs/math/test/test_laguerre.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -82,16 +82,16 @@
".*", // test data group
".*", 40000, 1000); // test function
add_expected_result(
- ".*mingw.*", // compiler
+ "GNU.*", // compiler
".*", // stdlib
- ".*", // platform
+ "Win32.*", // platform
largest_type, // test type(s)
".*", // test data group
".*", 40000, 1000); // test function
add_expected_result(
- ".*mingw.*", // compiler
+ "GNU.*", // compiler
".*", // stdlib
- ".*", // platform
+ "Win32.*", // platform
"real_concept", // test type(s)
".*", // test data group
".*", 40000, 1000); // test function
Modified: branches/release/libs/math/test/test_laguerre.hpp
==============================================================================
--- branches/release/libs/math/test/test_laguerre.hpp (original)
+++ branches/release/libs/math/test/test_laguerre.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -14,16 +14,17 @@
#include "handle_test_result.hpp"
#include "test_legendre_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_laguerre2(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(unsigned, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -40,20 +41,20 @@
//
// test laguerre against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int1(funcp, 0, 1),
- extract_result(2));
+ bind_func_int1<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::laguerre(n, x)", test_name);
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_laguerre3(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(unsigned, unsigned, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -70,10 +71,10 @@
//
// test laguerre against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int2(funcp, 0, 1, 2),
- extract_result(3));
+ bind_func_int2<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::laguerre(n, m, x)", test_name);
std::cout << std::endl;
}
@@ -89,11 +90,11 @@
//
# include "laguerre2.ipp"
- do_test_laguerre2(laguerre2, name, "Laguerre Polynomials");
+ do_test_laguerre2<T>(laguerre2, name, "Laguerre Polynomials");
# include "laguerre3.ipp"
- do_test_laguerre3(laguerre3, name, "Associated Laguerre Polynomials");
+ do_test_laguerre3<T>(laguerre3, name, "Associated Laguerre Polynomials");
}
template <class T>
Modified: branches/release/libs/math/test/test_legendre.hpp
==============================================================================
--- branches/release/libs/math/test/test_legendre.hpp (original)
+++ branches/release/libs/math/test/test_legendre.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -18,16 +18,17 @@
#include "handle_test_result.hpp"
#include "test_legendre_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_legendre_p(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(int, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -44,18 +45,18 @@
//
// test legendre_p against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int1(funcp, 0, 1),
- extract_result(2));
+ bind_func_int1<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::legendre_p", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::legendre_p;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int1(funcp, 0, 1),
- extract_result(2));
+ bind_func_int1<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::legendre_p");
}
#endif
@@ -70,18 +71,18 @@
//
// test legendre_q against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int1(funcp2, 0, 1),
- extract_result(3));
+ bind_func_int1<Real>(funcp2, 0, 1),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::legendre_q", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::legendre_q;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int1(funcp2, 0, 1),
- extract_result(3));
+ bind_func_int1<Real>(funcp2, 0, 1),
+ extract_result<Real>(3));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::legendre_q");
}
#endif
@@ -90,11 +91,11 @@
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_assoc_legendre_p(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(int, int, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -111,10 +112,10 @@
//
// test legendre_p against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int2(funcp, 0, 1, 2),
- extract_result(3));
+ bind_func_int2<Real>(funcp, 0, 1, 2),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::legendre_p", test_name);
std::cout << std::endl;
}
@@ -130,15 +131,15 @@
//
# include "legendre_p.ipp"
- do_test_legendre_p(legendre_p, name, "Legendre Polynomials: Small Values");
+ do_test_legendre_p<T>(legendre_p, name, "Legendre Polynomials: Small Values");
# include "legendre_p_large.ipp"
- do_test_legendre_p(legendre_p_large, name, "Legendre Polynomials: Large Values");
+ do_test_legendre_p<T>(legendre_p_large, name, "Legendre Polynomials: Large Values");
# include "assoc_legendre_p.ipp"
- do_test_assoc_legendre_p(assoc_legendre_p, name, "Associated Legendre Polynomials: Small Values");
+ do_test_assoc_legendre_p<T>(assoc_legendre_p, name, "Associated Legendre Polynomials: Small Values");
}
Modified: branches/release/libs/math/test/test_long_double_support.cpp
==============================================================================
--- branches/release/libs/math/test/test_long_double_support.cpp (original)
+++ branches/release/libs/math/test/test_long_double_support.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -23,6 +23,7 @@
#include <boost/array.hpp>
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#include <boost/math/tools/config.hpp>
@@ -61,15 +62,15 @@
//
result = boost::math::tools::test(
data,
- bind_func(proc, 0),
- extract_result(1));
+ bind_func<value_type>(proc, 0),
+ extract_result<value_type>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, function_name, test_name);
if(inv_proc)
{
result = boost::math::tools::test(
data,
- bind_func(inv_proc, 1),
- extract_result(0));
+ bind_func<value_type>(inv_proc, 1),
+ extract_result<value_type>(0));
handle_test_result(result, data[result.worst()], result.worst(), type_name, inv_function_name, test_name);
}
}
@@ -104,8 +105,13 @@
0.125L, 0.124674733385227689957442708712108467587834905641679257885515L,
-0.125L, -0.124674733385227689957442708712108467587834905641679257885515L,
1.125L, 0.902267594099095162918416128654829100758989018716070814389152L,
+#if LDBL_MAX_EXP > DBL_MAX_EXP
1e-500L, 1e-500L,
1e-1500L, 1e-1500L,
+#else
+ 0, 0,
+ 0, 0,
+#endif
}};
unary_proc = std::sin;
inv_unary_proc = std::asin;
@@ -116,17 +122,17 @@
//
// TAN:
//
- boost::array<boost::array<long double, 2>, 7> tan_test_data = {{
+ boost::array<boost::array<long double, 2>, 6> tan_test_data = {{
0, 0,
0.125L, 0.125655136575130967792678218629774000758665763892225542668867L,
-0.125L, -0.125655136575130967792678218629774000758665763892225542668867L,
1.125L, 2.09257127637217900442373398123488678225994171614872057291399L,
+#if LDBL_MAX_EXP > DBL_MAX_EXP
1e-500L, 1e-500L,
1e-1500L, 1e-1500L,
-#if LDBL_MAX_EXP > DBL_MAX_EXP
- 1.57079632679489661923132169163975144209858469968755291048747L, 1e500L,
#else
0, 0,
+ 0, 0,
#endif
}};
unary_proc = std::tan;
Modified: branches/release/libs/math/test/test_nc_beta.cpp
==============================================================================
--- branches/release/libs/math/test/test_nc_beta.cpp (original)
+++ branches/release/libs/math/test/test_nc_beta.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -34,6 +34,7 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
#include "test_ncbeta_hooks.hpp"
+#include "table_type.hpp"
#include <iostream>
using std::cout;
@@ -290,38 +291,38 @@
return cdf(complement(boost::math::non_central_beta_distribution<T>(a, b, nc), x));
}
-template <typename T>
+template <typename Real, typename T>
void do_test_nc_chi_squared(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
value_type (*fp1)(value_type, value_type, value_type, value_type) = nc_beta_cdf;
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0, 1, 2, 3),
- extract_result(4));
+ bind_func<Real>(fp1, 0, 1, 2, 3),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "CDF", test);
fp1 = nc_beta_ccdf;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0, 1, 2, 3),
- extract_result(5));
+ bind_func<Real>(fp1, 0, 1, 2, 3),
+ extract_result<Real>(5));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "CCDF", test);
#ifdef TEST_OTHER
fp1 = other::ncbeta_cdf;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0, 1, 2, 3),
- extract_result(4));
+ bind_func<Real>(fp1, 0, 1, 2, 3),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "Other::CDF", test);
#endif
@@ -329,11 +330,11 @@
}
-template <typename T>
+template <typename Real, typename T>
void quantile_sanity_check(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
//
// Tests with type real_concept take rather too long to run, so
@@ -415,12 +416,12 @@
{
#if !defined(TEST_DATA) || (TEST_DATA == 1)
#include "ncbeta.ipp"
- do_test_nc_chi_squared(ncbeta, type_name, "Non Central Beta, medium parameters");
- quantile_sanity_check(ncbeta, type_name, "Non Central Beta, medium parameters");
+ do_test_nc_chi_squared<T>(ncbeta, type_name, "Non Central Beta, medium parameters");
+ quantile_sanity_check<T>(ncbeta, type_name, "Non Central Beta, medium parameters");
#endif
#if !defined(TEST_DATA) || (TEST_DATA == 2)
#include "ncbeta_big.ipp"
- do_test_nc_chi_squared(ncbeta_big, type_name, "Non Central Beta, large parameters");
+ do_test_nc_chi_squared<T>(ncbeta_big, type_name, "Non Central Beta, large parameters");
// Takes too long to run:
// quantile_sanity_check(ncbeta_big, type_name, "Non Central Beta, large parameters");
#endif
Modified: branches/release/libs/math/test/test_nc_chi_squared.cpp
==============================================================================
--- branches/release/libs/math/test/test_nc_chi_squared.cpp (original)
+++ branches/release/libs/math/test/test_nc_chi_squared.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -31,6 +31,7 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
#include "test_nccs_hooks.hpp"
+#include "table_type.hpp"
#include <iostream>
using std::cout;
@@ -357,38 +358,38 @@
return cdf(complement(boost::math::non_central_chi_squared_distribution<T>(df, nc), x));
}
-template <typename T>
+template <typename Real, typename T>
void do_test_nc_chi_squared(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
value_type (*fp1)(value_type, value_type, value_type) = nccs_cdf;
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0, 1, 2),
- extract_result(3));
+ bind_func<Real>(fp1, 0, 1, 2),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "CDF", test);
fp1 = nccs_ccdf;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0, 1, 2),
- extract_result(4));
+ bind_func<Real>(fp1, 0, 1, 2),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "CCDF", test);
#ifdef TEST_OTHER
fp1 = other::nccs_cdf;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0, 1, 2),
- extract_result(3));
+ bind_func<Real>(fp1, 0, 1, 2),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "other::CDF", test);
#endif
@@ -397,11 +398,11 @@
}
-template <typename T>
+template <typename Real, typename T>
void quantile_sanity_check(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
//
// Tests with type real_concept take rather too long to run, so
@@ -429,7 +430,7 @@
for(unsigned i = 0; i < data.size(); ++i)
{
- if(data[i][3] == 0)
+ if(Real(data[i][3]) == 0)
{
BOOST_CHECK(0 == quantile(boost::math::non_central_chi_squared_distribution<value_type>(data[i][0], data[i][1]), data[i][3]));
}
@@ -500,12 +501,12 @@
void test_accuracy(T, const char* type_name)
{
#include "nccs.ipp"
- do_test_nc_chi_squared(nccs, type_name, "Non Central Chi Squared, medium parameters");
- quantile_sanity_check(nccs, type_name, "Non Central Chi Squared, medium parameters");
+ do_test_nc_chi_squared<T>(nccs, type_name, "Non Central Chi Squared, medium parameters");
+ quantile_sanity_check<T>(nccs, type_name, "Non Central Chi Squared, medium parameters");
#include "nccs_big.ipp"
- do_test_nc_chi_squared(nccs_big, type_name, "Non Central Chi Squared, large parameters");
- quantile_sanity_check(nccs_big, type_name, "Non Central Chi Squared, large parameters");
+ do_test_nc_chi_squared<T>(nccs_big, type_name, "Non Central Chi Squared, large parameters");
+ quantile_sanity_check<T>(nccs_big, type_name, "Non Central Chi Squared, large parameters");
}
int test_main(int, char* [])
@@ -524,7 +525,7 @@
#ifdef TEST_LDOUBLE
test_spots(0.0L); // Test long double.
#endif
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
#ifdef TEST_REAL_CONCEPT
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
@@ -541,7 +542,7 @@
#ifdef TEST_LDOUBLE
test_accuracy(0.0L, "long double"); // Test long double.
#endif
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
#ifdef TEST_REAL_CONCEPT
test_accuracy(boost::math::concepts::real_concept(0.), "real_concept"); // Test real concept.
#endif
Modified: branches/release/libs/math/test/test_nc_t.cpp
==============================================================================
--- branches/release/libs/math/test/test_nc_t.cpp (original)
+++ branches/release/libs/math/test/test_nc_t.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -29,6 +29,7 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#include <iostream>
using std::cout;
@@ -343,29 +344,29 @@
return cdf(complement(boost::math::non_central_t_distribution<T>(df, nc), x));
}
-template <typename T>
+template <typename Real, typename T>
void do_test_nc_t(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << "Testing: " << test << std::endl;
value_type (*fp1)(value_type, value_type, value_type) = nct_cdf;
boost::math::tools::test_result<value_type> result;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0, 1, 2),
- extract_result(3));
+ bind_func<Real>(fp1, 0, 1, 2),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "CDF", test);
fp1 = nct_ccdf;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(fp1, 0, 1, 2),
- extract_result(4));
+ bind_func<Real>(fp1, 0, 1, 2),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "CCDF", test);
@@ -373,11 +374,11 @@
}
-template <typename T>
+template <typename Real, typename T>
void quantile_sanity_check(T& data, const char* type_name, const char* test)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
//
// Tests with type real_concept take rather too long to run, so
@@ -478,8 +479,8 @@
void test_accuracy(T, const char* type_name)
{
#include "nct.ipp"
- do_test_nc_t(nct, type_name, "Non Central T");
- quantile_sanity_check(nct, type_name, "Non Central T");
+ do_test_nc_t<T>(nct, type_name, "Non Central T");
+ quantile_sanity_check<T>(nct, type_name, "Non Central T");
}
int test_main(int, char* [])
@@ -499,7 +500,7 @@
#ifdef TEST_LDOUBLE
test_spots(0.0L); // Test long double.
#endif
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
#ifdef TEST_REAL_CONCEPT
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
@@ -516,7 +517,7 @@
#ifdef TEST_LDOUBLE
test_accuracy(0.0L, "long double"); // Test long double.
#endif
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
#ifdef TEST_REAL_CONCEPT
test_accuracy(boost::math::concepts::real_concept(0.), "real_concept"); // Test real concept.
#endif
Modified: branches/release/libs/math/test/test_negative_binomial.cpp
==============================================================================
--- branches/release/libs/math/test/test_negative_binomial.cpp (original)
+++ branches/release/libs/math/test/test_negative_binomial.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -37,6 +37,7 @@
#include <boost/test/test_exec_monitor.hpp> // for test_main
#include <boost/test/floating_point_comparison.hpp> // for BOOST_CHECK_CLOSE
+#include "table_type.hpp"
#include <iostream>
using std::cout;
@@ -818,7 +819,7 @@
#ifdef TEST_LDOUBLE
test_spots(0.0L); // Test long double.
#endif
- #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
#ifdef TEST_REAL_CONCEPT
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
Modified: branches/release/libs/math/test/test_nonfinite_trap.cpp
==============================================================================
--- branches/release/libs/math/test/test_nonfinite_trap.cpp (original)
+++ branches/release/libs/math/test/test_nonfinite_trap.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -5,23 +5,26 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
+// test_nonfinite_trap.cpp
+
#ifdef _MSC_VER
# pragma warning(disable : 4702)
#endif
#define BOOST_TEST_MAIN
-#include <locale>
-#include <sstream>
#include <boost/test/auto_unit_test.hpp>
-#include "almost_equal.ipp"
-#include "s_.ipp"
+#include "almost_equal.ipp" // Similar to BOOST_CLOSE_FRACTION.
+#include "s_.ipp" // To create test strings like std::basic_string<CharType> s = S_("0 -0");
#include <boost/math/special_functions/nonfinite_num_facets.hpp>
+#include <locale>
+#include <sstream>
+
namespace {
-// the anonymous namespace resolves ambiguities on platforms
-// with fpclassify etc functions at global scope
+// Using an anonymous namespace resolves ambiguities on platforms
+// with fpclassify etc functions at global scope.
using namespace boost::math;
using boost::math::signbit;
@@ -233,3 +236,4 @@
//------------------------------------------------------------------------------
} // anonymous namespace
+
Modified: branches/release/libs/math/test/test_poisson.cpp
==============================================================================
--- branches/release/libs/math/test/test_poisson.cpp (original)
+++ branches/release/libs/math/test/test_poisson.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -33,6 +33,7 @@
#include <boost/math/special_functions/gamma.hpp> // for (incomplete) gamma.
// using boost::math::qamma_Q;
+#include "table_type.hpp"
#include <iostream>
using std::cout;
@@ -599,11 +600,11 @@
#endif
}
- #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
#ifdef TEST_REAL_CONCEPT
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
- #endif
+#endif
#endif
return 0;
} // int test_main(int, char* [])
Modified: branches/release/libs/math/test/test_roots.cpp
==============================================================================
--- branches/release/libs/math/test/test_roots.cpp (original)
+++ branches/release/libs/math/test/test_roots.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -13,6 +13,7 @@
#include <boost/test/results_collector.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/array.hpp>
+#include "table_type.hpp"
#define BOOST_CHECK_CLOSE_EX(a, b, prec, i) \
{\
@@ -237,12 +238,12 @@
}
-template <class T>
+template <class Real, class T>
void test_inverses(const T& data)
{
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::policies::digits<value_type, boost::math::policies::policy<> >()/2)) * 100;
if(boost::math::policies::digits<value_type, boost::math::policies::policy<> >() < 50)
@@ -258,37 +259,37 @@
//
if(data[i][5] == 0)
{
- BOOST_CHECK_EQUAL(inverse_ibeta_halley(data[i][0], data[i][1], data[i][5]), value_type(0));
- BOOST_CHECK_EQUAL(inverse_ibeta_schroeder(data[i][0], data[i][1], data[i][5]), value_type(0));
- BOOST_CHECK_EQUAL(inverse_ibeta_newton(data[i][0], data[i][1], data[i][5]), value_type(0));
- BOOST_CHECK_EQUAL(inverse_ibeta_bisect(data[i][0], data[i][1], data[i][5]), value_type(0));
+ BOOST_CHECK_EQUAL(inverse_ibeta_halley(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(0));
+ BOOST_CHECK_EQUAL(inverse_ibeta_schroeder(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(0));
+ BOOST_CHECK_EQUAL(inverse_ibeta_newton(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(0));
+ BOOST_CHECK_EQUAL(inverse_ibeta_bisect(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(0));
}
else if((1 - data[i][5] > 0.001)
&& (fabs(data[i][5]) > 2 * boost::math::tools::min_value<value_type>())
&& (fabs(data[i][5]) > 2 * boost::math::tools::min_value<double>()))
{
- value_type inv = inverse_ibeta_halley(data[i][0], data[i][1], data[i][5]);
- BOOST_CHECK_CLOSE_EX(data[i][2], inv, precision, i);
- inv = inverse_ibeta_schroeder(data[i][0], data[i][1], data[i][5]);
- BOOST_CHECK_CLOSE_EX(data[i][2], inv, precision, i);
- inv = inverse_ibeta_newton(data[i][0], data[i][1], data[i][5]);
- BOOST_CHECK_CLOSE_EX(data[i][2], inv, precision, i);
- inv = inverse_ibeta_bisect(data[i][0], data[i][1], data[i][5]);
- BOOST_CHECK_CLOSE_EX(data[i][2], inv, precision, i);
+ value_type inv = inverse_ibeta_halley(Real(data[i][0]), Real(data[i][1]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][2]), inv, precision, i);
+ inv = inverse_ibeta_schroeder(Real(data[i][0]), Real(data[i][1]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][2]), inv, precision, i);
+ inv = inverse_ibeta_newton(Real(data[i][0]), Real(data[i][1]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][2]), inv, precision, i);
+ inv = inverse_ibeta_bisect(Real(data[i][0]), Real(data[i][1]), Real(data[i][5]));
+ BOOST_CHECK_CLOSE_EX(Real(data[i][2]), inv, precision, i);
}
else if(1 == data[i][5])
{
- BOOST_CHECK_EQUAL(inverse_ibeta_halley(data[i][0], data[i][1], data[i][5]), value_type(1));
- BOOST_CHECK_EQUAL(inverse_ibeta_schroeder(data[i][0], data[i][1], data[i][5]), value_type(1));
- BOOST_CHECK_EQUAL(inverse_ibeta_newton(data[i][0], data[i][1], data[i][5]), value_type(1));
- BOOST_CHECK_EQUAL(inverse_ibeta_bisect(data[i][0], data[i][1], data[i][5]), value_type(1));
+ BOOST_CHECK_EQUAL(inverse_ibeta_halley(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(1));
+ BOOST_CHECK_EQUAL(inverse_ibeta_schroeder(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(1));
+ BOOST_CHECK_EQUAL(inverse_ibeta_newton(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(1));
+ BOOST_CHECK_EQUAL(inverse_ibeta_bisect(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(1));
}
}
}
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
template <class T>
@@ -302,15 +303,15 @@
//
# include "ibeta_small_data.ipp"
- test_inverses(ibeta_small_data);
+ test_inverses<T>(ibeta_small_data);
# include "ibeta_data.ipp"
- test_inverses(ibeta_data);
+ test_inverses<T>(ibeta_data);
# include "ibeta_large_data.ipp"
- test_inverses(ibeta_large_data);
+ test_inverses<T>(ibeta_large_data);
}
int test_main(int, char* [])
Modified: branches/release/libs/math/test/test_sign.cpp
==============================================================================
--- branches/release/libs/math/test/test_sign.cpp (original)
+++ branches/release/libs/math/test/test_sign.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -33,7 +33,7 @@
// Compare to formula for changsign(x) = copysign(x, signbit(x) ? 1.0 : -1.0)
BOOST_CHECK_EQUAL((boost::math::changesign)(b),
- boost::math::copysign(b, boost::math::signbit(b) ? RealType(1.) : RealType(-1.) ));
+ (boost::math::copysign)(b, (boost::math::signbit)(b) ? RealType(1.) : RealType(-1.) ));
BOOST_CHECK_EQUAL((boost::math::copysign)(b, a), RealType(1));
@@ -146,7 +146,9 @@
test_spots(0.0, "double"); // Test double. OK at decdigits 7, tolerance = 1e07 %
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L, "long double"); // Test long double.
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
test_spots(boost::math::concepts::real_concept(0), "real_concept"); // Test real_concept.
+#endif
#else
std::cout << "<note>The long double tests have been disabled on this platform "
"either because the long double overloads of the usual math functions are "
Modified: branches/release/libs/math/test/test_signed_zero.cpp
==============================================================================
--- branches/release/libs/math/test/test_signed_zero.cpp (original)
+++ branches/release/libs/math/test/test_signed_zero.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -1,89 +1,263 @@
-// Copyright (c) 2006 Johan Rade
-// Copyright (c) 2011 Paul A. Bristow To incorporate into Boost.Math
+// Copyright 2006 Johan Rade
+// Copyright 2011 Paul A. Bristow To incorporate into Boost.Math
+// Copyright 2012 Paul A. Bristow with new tests.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifdef _MSC_VER
-# pragma warning(disable : 4702) // Unreachable code.
-# pragma warning(disable : 4127) // expression is constant.
+# pragma warning(disable : 4127) // Expression is constant.
#endif
#define BOOST_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/math/special_functions/nonfinite_num_facets.hpp>
+#include "s_.ipp" // To create test strings like std::basic_string<CharType> s = S_("0 -0");
+
#include <iomanip>
#include <locale>
#include <sstream>
+#include <ostream>
#include <limits>
-#include <boost/test/auto_unit_test.hpp>
-#include <boost/math/special_functions/nonfinite_num_facets.hpp>
-#include "almost_equal.ipp"
-#include "s_.ipp"
-
namespace {
-// the anonymous namespace resolves ambiguities on platforms
-// with fpclassify etc functions at global scope
+ // Using an anonymous namespace resolves ambiguities on platforms
+ // with fpclassify etc functions at global scope.
-using namespace boost::math;
-using boost::math::signbit;
-using boost::math::changesign;
-using boost::math::isnan;
+ using namespace boost::math;
+ using boost::math::signbit;
+ using boost::math::changesign;
+ using boost::math::isnan;
+
+ //------------------------------------------------------------------------------
+
+ template<class CharType, class ValType> void signed_zero_test_impl();
+ // Loopback tests using all built-in char and floating-point types.
+
+ BOOST_AUTO_TEST_CASE(signed_zero_test)
+ {
+ std::cout
+ << "BuildInfo:" << '\n'
+ << " platform " << BOOST_PLATFORM << '\n'
+ << " compiler " << BOOST_COMPILER << '\n'
+ << " STL " << BOOST_STDLIB << '\n'
+ << " Boost version " << BOOST_VERSION/100000 << "."
+ << BOOST_VERSION/100 % 1000 << "."
+ << BOOST_VERSION % 100
+ << std::endl;
-//------------------------------------------------------------------------------
-
-template<class CharType, class ValType> void signed_zero_test_impl();
-
-BOOST_AUTO_TEST_CASE(signed_zero_test)
-{
signed_zero_test_impl<char, float>();
signed_zero_test_impl<char, double>();
signed_zero_test_impl<char, long double>();
signed_zero_test_impl<wchar_t, float>();
signed_zero_test_impl<wchar_t, double>();
signed_zero_test_impl<wchar_t, long double>();
-}
+ }
-template<class CharType, class ValType> void signed_zero_test_impl()
-{
+ template<class CharType, class ValType> void signed_zero_test_impl()
+ {
- if (signbit(static_cast<CharType>(-1e-6f)/(std::numeric_limits<CharType>::max)()) != -0)
- {
- BOOST_TEST_MESSAGE("Signed zero is not supported on this platform.");
- return;
- }
+ if (signbit(static_cast<CharType>(-1e-6f) / (std::numeric_limits<CharType>::max)()) != -0)
+ {
+ BOOST_TEST_MESSAGE("Signed zero is not supported on this platform!");
+ return;
+ }
std::locale old_locale;
std::locale tmp_locale(
- old_locale, new nonfinite_num_put<CharType>(signed_zero));
+ old_locale, new nonfinite_num_put<CharType>(signed_zero));
std::locale new_locale(tmp_locale, new nonfinite_num_get<CharType>);
std::basic_stringstream<CharType> ss;
ss.imbue(new_locale);
- ValType a1 = static_cast<ValType>(0);
- ValType a2 = (changesign)(static_cast<ValType>(0));
- BOOST_CHECK(!(signbit)(a1));
+ std::basic_string<CharType> null = S_("");
+
+ std::basic_string<CharType> s1 = S_("123");
+ ss << s1 << std::endl;
+ ss.str(null);
+
+
+ BOOST_CHECK(ss.str() == null); //
+
+ ValType a1 = static_cast<ValType>(0); // zero.
+ ValType a2 = (changesign)(static_cast<ValType>(0)); // negative signed zero.
+ BOOST_CHECK(!(signbit)(a1)); //
BOOST_CHECK((signbit)(a2));
ss << a1 << ' ' << a2;
- std::basic_string<CharType> s = S_("0 -0");
+ std::basic_string<CharType> s = S_("0 -0"); // Expected.
BOOST_CHECK(ss.str() == s);
ValType b1, b2;
- ss >> b1 >> b2;
+ ss >> b1 >> b2; // Read back in.
BOOST_CHECK(b1 == a1);
BOOST_CHECK(b2 == a2);
BOOST_CHECK(!(signbit)(b1));
BOOST_CHECK((signbit)(b2));
BOOST_CHECK(ss.rdstate() == std::ios_base::eofbit);
-}
+ } // template<class CharType, class ValType> void signed_zero_test_impl()
+
+ // Checking output of types char using first default & then using signed_zero flag.
+#define CHECKOUT(manips, expected)\
+ {\
+ {\
+ std::locale old_locale;\
+ std::locale tmp_locale(old_locale, new nonfinite_num_put<char>(0));\
+ std::locale new_locale(tmp_locale, new nonfinite_num_get<char>);\
+ std::ostringstream ss;\
+ ss.imbue(new_locale);\
+ ss << manips;\
+ std::basic_string<char> s = S_(expected);\
+ BOOST_CHECK_EQUAL(ss.str(), s);\
+ }\
+ {\
+ std::locale old_locale;\
+ std::locale tmp_locale(old_locale, new nonfinite_num_put<char>(signed_zero));\
+ std::locale new_locale(tmp_locale, new nonfinite_num_get<char>);\
+ std::ostringstream ss;\
+ ss.imbue(new_locale);\
+ ss << manips;\
+ std::basic_string<char> s = S_(expected);\
+ BOOST_CHECK_EQUAL(ss.str(), s);\
+ }\
+ }\
+
+ BOOST_AUTO_TEST_CASE(misc_output_tests)
+ { // Tests of output using a variety of output options.
+
+ //
+ // STD libraries don't all format zeros the same,
+ // so figure out what the library-specific formatting is
+ // and then make sure that our facet produces the same...
+ //
+ bool precision_after = false; // Prints N digits after the point rather than N digits total
+ bool triple_exponent = false; // Has 3 digits in the exponent rather than 2.
+ std::stringstream ss;
+ ss << std::showpoint << std::setprecision(6) << 0.0;
+ if(ss.str().size() == 8)
+ precision_after = true;
+ ss.str("");
+ ss << std::scientific << 0.0;
+ triple_exponent = ss.str().size() - ss.str().find_first_of('e') == 5;
+
+
+
+ // Positive zero.
+ CHECKOUT(0, "0"); // integer zero.
+ CHECKOUT(0., "0"); // double zero.
+ CHECKOUT(std::setw(2) << 0., " 0");
+ CHECKOUT(std::setw(4) << 0., " 0");
+ CHECKOUT(std::right << std::setw(4) << 0., " 0");
+ CHECKOUT(std::left << std::setw(4) << 0., "0 ");
+ CHECKOUT(std::setw(4) << std::setfill('*') << 0., "***0");
+ CHECKOUT(std::setw(4) << std::internal << std::setfill('*') << 0., "***0"); // left adjust sign and right adjust value.
+ CHECKOUT(std::showpos << std::setw(4) << std::internal << std::setfill('*') << 0., "+**0"); // left adjust sign and right adjust value.
+
+ if(precision_after)
+ {
+// BOOST_STDLIB == ("Dinkumware standard library version" BOOST_STRINGIZE(_CPPLIB_VER)) )
+ CHECKOUT(std::showpoint << 0., "0.000000"); // std::setprecision(6)
+ CHECKOUT(std::setprecision(2) << std::showpoint << 0., "0.00");
+ }
+ else
+ {
+ CHECKOUT(std::showpoint << 0., "0.00000"); // std::setprecision(6)
+ CHECKOUT(std::setprecision(2) << std::showpoint << 0., "0.0");
+ }
+ CHECKOUT(std::fixed << std::setw(5) << std::setfill('0') << std::setprecision(2) << 0., "00.00");
+ CHECKOUT(std::fixed << std::setw(6) << std::setfill('0') << std::setprecision(2) << 0., "000.00");
+ CHECKOUT(std::fixed << std::setw(6) << std::setfill('0') << std::setprecision(3) << 0., "00.000");
+ CHECKOUT(std::fixed << std::setw(6) << std::setfill('*') << std::setprecision(3) << 0., "*0.000");
+ CHECKOUT(std::fixed << std::setw(6) << std::setfill('*') << std::setprecision(2) << std::left << 0.0, "0.00**");
+
+ CHECKOUT(std::showpos << 0., "+0");
+ CHECKOUT(std::showpos << std::fixed << std::setw(6) << std::setfill('*') << std::setprecision(2) << std::left << 0.0, "+0.00*");
+ if(triple_exponent)
+ {
+ CHECKOUT(std::scientific << std::showpoint << std::setw(10) << std::setfill('*') << std::setprecision(1) << std::left << 0., "0.0e+000**");
+ }
+ else
+ {
+ CHECKOUT(std::scientific << std::showpoint << std::setw(10) << std::setfill('*') << std::setprecision(1) << std::left << 0., "0.0e+00***");
+ }
+ CHECKOUT(std::fixed << std::showpoint << std::setw(6) << std::setfill('*') << std::setprecision(3) << std::left << 0., "0.000*");
+
+ double nz = (changesign)(static_cast<double>(0)); // negative signed zero.
+ CHECKOUT(nz, "-0");
+ // CHECKOUT(std::defaultfloat << nz, "-0"); Only for C++11
+ CHECKOUT(std::showpos << nz, "-0"); // Ignore showpos because is negative.
+ CHECKOUT(std::setw(2) << nz, "-0");
+ CHECKOUT(std::setw(4) << nz, " -0");
+ CHECKOUT(std::right << std::setw(4) << nz, " -0");
+ CHECKOUT(std::left << std::setw(4) << nz, "-0 ");
+ CHECKOUT(std::setw(4) << std::setfill('*') << nz, "**-0");
+ CHECKOUT(std::setw(4) << std::internal << std::setfill('*') << nz, "-**0"); // Use std::internal to left adjust sign and right adjust value.
+ CHECKOUT(std::showpos << std::setw(4) << std::internal << std::setfill('*') << nz, "-**0");
+
+ CHECKOUT(std::fixed << std::setw(5) << std::setfill('0') << std::setprecision(2) << 0., "00.00");
+ CHECKOUT(std::fixed << std::setw(6) << std::setfill('0') << std::setprecision(2) << 0., "000.00");
+ CHECKOUT(std::fixed << std::setw(6) << std::setfill('0') << std::setprecision(3) << 0., "00.000");
+ CHECKOUT(std::fixed << std::setw(6) << std::setfill('*') << std::setprecision(3) << 0., "*0.000");
+ CHECKOUT(std::fixed << std::setw(6) << std::setfill('*') << std::setprecision(2) << std::left << 0.0, "0.00**");
+ CHECKOUT(std::setprecision(2) << nz, "-0"); // No showpoint, so no decimal point nor trailing zeros.
+ if(precision_after)
+ {
+ CHECKOUT(std::setprecision(2) << std::showpoint << nz, "-0.00"); // or "-0.0"
+ CHECKOUT(std::setw(1) << std::setprecision(3) << std::showpoint << nz, "-0.000"); // Not enough width for precision overflows width. or "-0.00"
+ }
+ else
+ {
+ CHECKOUT(std::setprecision(2) << std::showpoint << nz, "-0.0"); // or "-0.00"
+ CHECKOUT(std::setw(1) << std::setprecision(3) << std::showpoint << nz, "-0.00"); // Not enough width for precision overflows width. or "-0.000"
+ }
+ if(triple_exponent)
+ {
+ CHECKOUT(std::scientific << std::showpoint << std::setw(10) << std::setfill('*') << std::setprecision(1) << std::left << nz, "-0.0e+000*"); // -0.0e+00**
+ }
+ else
+ {
+ CHECKOUT(std::scientific << std::showpoint << std::setw(10) << std::setfill('*') << std::setprecision(1) << std::left << nz, "-0.0e+00**"); // -0.0e+000*
+ }
+ CHECKOUT(std::fixed << std::showpoint << std::setw(6) << std::setfill('*') << std::setprecision(3) << std::left << 0., "0.000*");
+
+ // Non zero values.
+
+ CHECKOUT(std::showpos << std::fixed << std::setw(6) << std::setfill('*') << std::setprecision(2) << std::left << 42., "+42.00");
+ CHECKOUT(std::showpos << std::fixed << std::setw(6) << std::setfill('*') << std::setprecision(2) << std::left << 4.2, "+4.20*");
+ CHECKOUT(std::showpos << std::fixed << std::setw(6) << std::setfill('*') << std::setprecision(2) << std::left << 1.22, "+1.22*");
+ CHECKOUT(std::showpos << std::fixed << std::setw(6) << std::setfill('*') << std::setprecision(2) << std::left << 0.12, "+0.12*");
-//------------------------------------------------------------------------------
+ CHECKOUT(std::setprecision(4) << std::showpoint << 1.2, "1.200");
+
+ }
} // anonymous namespace
+
+/*
+
+Output:
+
+test_signed_zero.cpp
+ Running 2 test cases...
+ Platform: Win32
+ Compiler: Microsoft Visual C++ version 10.0
+ STL : Dinkumware standard library version 520
+ Boost : 1.49.0
+ Entering test suite "Master Test Suite"
+ Entering test case "signed_zero_test"
+ Leaving test case "signed_zero_test"; testing time: 2ms
+ Entering test case "misc_output_tests"
+ Leaving test case "misc_output_tests"; testing time: 15ms
+ Leaving test suite "Master Test Suite"
+
+ *** No errors detected
+
+*/
+
Modified: branches/release/libs/math/test/test_spherical_harmonic.cpp
==============================================================================
--- branches/release/libs/math/test/test_spherical_harmonic.cpp (original)
+++ branches/release/libs/math/test/test_spherical_harmonic.cpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -14,6 +14,7 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
//
// DESCRIPTION:
@@ -96,11 +97,11 @@
<< BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_spherical_harmonic(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(unsigned, int, value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -117,10 +118,10 @@
//
// test Spheric Harmonic against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int2(funcp, 0, 1, 2, 3),
- extract_result(4));
+ bind_func_int2<Real>(funcp, 0, 1, 2, 3),
+ extract_result<Real>(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::spherical_harmonic_r", test_name);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -131,20 +132,20 @@
//
// test Spheric Harmonic against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func_int2(funcp, 0, 1, 2, 3),
- extract_result(5));
+ bind_func_int2<Real>(funcp, 0, 1, 2, 3),
+ extract_result<Real>(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::spherical_harmonic_i", test_name);
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void test_complex_spherical_harmonic(const T& data, const char* /* name */, boost::mpl::true_ const &)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
for(unsigned i = 0; i < sizeof(data) / sizeof(data[0]); ++i)
{
@@ -155,24 +156,24 @@
std::complex<value_type> r = boost::math::spherical_harmonic(
boost::math::tools::real_cast<unsigned>(data[i][0]),
boost::math::tools::real_cast<unsigned>(data[i][1]),
- data[i][2],
- data[i][3]);
+ Real(data[i][2]),
+ Real(data[i][3]));
value_type re = boost::math::spherical_harmonic_r(
boost::math::tools::real_cast<unsigned>(data[i][0]),
boost::math::tools::real_cast<unsigned>(data[i][1]),
- data[i][2],
- data[i][3]);
+ Real(data[i][2]),
+ Real(data[i][3]));
value_type im = boost::math::spherical_harmonic_i(
boost::math::tools::real_cast<unsigned>(data[i][0]),
boost::math::tools::real_cast<unsigned>(data[i][1]),
- data[i][2],
- data[i][3]);
+ Real(data[i][2]),
+ Real(data[i][3]));
BOOST_CHECK_CLOSE_FRACTION(std::real(r), re, value_type(5));
BOOST_CHECK_CLOSE_FRACTION(std::imag(r), im, value_type(5));
}
}
-template <class T>
+template <class Real, class T>
void test_complex_spherical_harmonic(const T& /* data */, const char* /* name */, boost::mpl::false_ const &)
{
// T is not a built in type, can't use std::complex with it...
@@ -189,9 +190,9 @@
//
# include "spherical_harmonic.ipp"
- do_test_spherical_harmonic(spherical_harmonic, name, "Spherical Harmonics");
+ do_test_spherical_harmonic<T>(spherical_harmonic, name, "Spherical Harmonics");
- test_complex_spherical_harmonic(spherical_harmonic, name, boost::is_floating_point<T>());
+ test_complex_spherical_harmonic<T>(spherical_harmonic, name, boost::is_floating_point<T>());
}
template <class T>
Modified: branches/release/libs/math/test/test_tgamma_ratio.hpp
==============================================================================
--- branches/release/libs/math/test/test_tgamma_ratio.hpp (original)
+++ branches/release/libs/math/test/test_tgamma_ratio.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -16,25 +16,27 @@
#include "functor.hpp"
#include "handle_test_result.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
+template <class Real>
struct negative_tgamma_ratio
{
template <class Row>
- typename Row::value_type operator()(const Row& row)
+ Real operator()(const Row& row)
{
- return boost::math::tgamma_delta_ratio(row[0], -row[1]);
+ return boost::math::tgamma_delta_ratio(Real(row[0]), -Real(row[1]));
}
};
-template <class T>
+template <class Real, class T>
void do_test_tgamma_delta_ratio(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -51,23 +53,23 @@
//
// test tgamma_delta_ratio against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a, delta)", test_name);
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- negative_tgamma_ratio(),
- extract_result(3));
+ negative_tgamma_ratio<Real>(),
+ extract_result<Real>(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a -delta)", test_name);
}
-template <class T>
+template <class Real, class T>
void do_test_tgamma_ratio(const T& data, const char* type_name, const char* test_name)
{
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
typedef value_type (*pg)(value_type, value_type);
#if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
@@ -84,10 +86,10 @@
//
// test tgamma_ratio against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_ratio(a, b)", test_name);
}
@@ -99,19 +101,19 @@
//
# include "tgamma_delta_ratio_data.ipp"
- do_test_tgamma_delta_ratio(tgamma_delta_ratio_data, name, "tgamma + small delta ratios");
+ do_test_tgamma_delta_ratio<T>(tgamma_delta_ratio_data, name, "tgamma + small delta ratios");
# include "tgamma_delta_ratio_int.ipp"
- do_test_tgamma_delta_ratio(tgamma_delta_ratio_int, name, "tgamma + small integer ratios");
+ do_test_tgamma_delta_ratio<T>(tgamma_delta_ratio_int, name, "tgamma + small integer ratios");
# include "tgamma_delta_ratio_int2.ipp"
- do_test_tgamma_delta_ratio(tgamma_delta_ratio_int2, name, "integer tgamma ratios");
+ do_test_tgamma_delta_ratio<T>(tgamma_delta_ratio_int2, name, "integer tgamma ratios");
# include "tgamma_ratio_data.ipp"
- do_test_tgamma_ratio(tgamma_ratio_data, name, "tgamma ratios");
+ do_test_tgamma_ratio<T>(tgamma_ratio_data, name, "tgamma ratios");
}
Modified: branches/release/libs/math/test/test_zeta.hpp
==============================================================================
--- branches/release/libs/math/test/test_zeta.hpp (original)
+++ branches/release/libs/math/test/test_zeta.hpp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -17,12 +17,13 @@
#include "handle_test_result.hpp"
#include "test_zeta_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
-template <class T>
+template <class Real, class T>
void do_test_zeta(const T& data, const char* type_name, const char* test_name)
{
//
@@ -30,7 +31,7 @@
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -45,20 +46,20 @@
//
// test zeta against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::zeta", test_name);
#ifdef TEST_OTHER
if(boost::is_floating_point<value_type>::value)
{
funcp = other::zeta;
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "other::zeta", test_name);
}
#endif
@@ -71,13 +72,13 @@
// The actual test data is rather verbose, so it's in a separate file
//
#include "zeta_data.ipp"
- do_test_zeta(zeta_data, name, "Zeta: Random values greater than 1");
+ do_test_zeta<T>(zeta_data, name, "Zeta: Random values greater than 1");
#include "zeta_neg_data.ipp"
- do_test_zeta(zeta_neg_data, name, "Zeta: Random values less than 1");
+ do_test_zeta<T>(zeta_neg_data, name, "Zeta: Random values less than 1");
#include "zeta_1_up_data.ipp"
- do_test_zeta(zeta_1_up_data, name, "Zeta: Values close to and greater than 1");
+ do_test_zeta<T>(zeta_1_up_data, name, "Zeta: Values close to and greater than 1");
#include "zeta_1_below_data.ipp"
- do_test_zeta(zeta_1_below_data, name, "Zeta: Values close to and less than 1");
+ do_test_zeta<T>(zeta_1_below_data, name, "Zeta: Values close to and less than 1");
}
extern "C" double zetac(double);
Modified: branches/release/libs/math/test/tgamma_delta_ratio_data.ipp
==============================================================================
--- branches/release/libs/math/test/tgamma_delta_ratio_data.ipp (original)
+++ branches/release/libs/math/test/tgamma_delta_ratio_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 560> tgamma_delta_ratio_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 560> tgamma_delta_ratio_data = { {
{{ SC_(0.2585242462158203125e2), SC_(0.5408298164866209845058619976043701171875e-7), SC_(0.9999998251530248995276873521622051469349e0), SC_(0.1000000174847005556584935896873247717521e1) }},
{{ SC_(0.2585242462158203125e2), SC_(0.676797071719192899763584136962890625e-7), SC_(0.999999781195646858662207729479648955493e0), SC_(0.1000000218804400836041852388787649318772e1) }},
{{ SC_(0.2585242462158203125e2), SC_(0.227188110102360951714217662811279296875e-6), SC_(0.9999992655149263979633607427932657111612e0), SC_(0.1000000734485611035140775476483228633931e1) }},
Modified: branches/release/libs/math/test/tgamma_delta_ratio_int.ipp
==============================================================================
--- branches/release/libs/math/test/tgamma_delta_ratio_int.ipp (original)
+++ branches/release/libs/math/test/tgamma_delta_ratio_int.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 344> tgamma_delta_ratio_int = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 344> tgamma_delta_ratio_int = { {
{{ SC_(0.24302618503570556640625e1), SC_(0.1e1), SC_(0.4114782939349022594054088894256271572472e0), SC_(0.14302618503570556640625e1) }},
{{ SC_(0.301645793914794921875e2), SC_(0.1e1), SC_(0.3315146506841289877594755891064182591548e-1), SC_(0.291645793914794921875e2) }},
{{ SC_(0.301645793914794921875e2), SC_(0.3e1), SC_(0.3307223761155750711531487469609546246538e-4), SC_(0.2231320586281996185139958610577082254167e5) }},
Modified: branches/release/libs/math/test/tgamma_delta_ratio_int2.ipp
==============================================================================
--- branches/release/libs/math/test/tgamma_delta_ratio_int2.ipp (original)
+++ branches/release/libs/math/test/tgamma_delta_ratio_int2.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 4>, 190> tgamma_delta_ratio_int2 = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 4>, 190> tgamma_delta_ratio_int2 = { {
{{ SC_(0.11e2), SC_(0.1e2), SC_(0.1491552059147518383844493235618106619139e-11), SC_(0.36288e7) }},
{{ SC_(0.12e2), SC_(0.1e2), SC_(0.7812891738391762962994964567523415624059e-12), SC_(0.399168e8) }},
{{ SC_(0.12e2), SC_(0.11e2), SC_(0.3551314426541710437724983894328825283663e-13), SC_(0.399168e8) }},
Modified: branches/release/libs/math/test/tgamma_ratio_data.ipp
==============================================================================
--- branches/release/libs/math/test/tgamma_ratio_data.ipp (original)
+++ branches/release/libs/math/test/tgamma_ratio_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 3>, 400> tgamma_ratio_data = { {
+ static const boost::array<boost::array<typename table_type<T>::type, 3>, 400> tgamma_ratio_data = { {
{{ SC_(6.68193912506103515625), SC_(6.68193912506103515625), SC_(1) }},
{{ SC_(6.68193912506103515625), SC_(8.095367431640625), SC_(0.06544775114440229981894259276990196062764) }},
{{ SC_(6.68193912506103515625), SC_(8.50289630889892578125), SC_(0.02833082889188931171456297874515804727699) }},
Modified: branches/release/libs/math/test/zeta_1_below_data.ipp
==============================================================================
--- branches/release/libs/math/test/zeta_1_below_data.ipp (original)
+++ branches/release/libs/math/test/zeta_1_below_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 24> zeta_1_below_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 24> zeta_1_below_data = {{
{{ SC_(0.02141654491424560546875), SC_(-0.5201506602793944998316548018699690797681) }},
{{ SC_(0.50472259521484375), SC_(-1.479059796502255763615575236860218694317) }},
{{ SC_(0.753675937652587890625), SC_(-3.500701844470537839375475836745309608254) }},
Modified: branches/release/libs/math/test/zeta_1_up_data.ipp
==============================================================================
--- branches/release/libs/math/test/zeta_1_up_data.ipp (original)
+++ branches/release/libs/math/test/zeta_1_up_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 24> zeta_1_up_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 24> zeta_1_up_data = {{
{{ SC_(1.00000011920928955078125), SC_(8388608.57721567358185799990090564625463) }},
{{ SC_(1.0000002384185791015625), SC_(4194304.577215682262183001486952251646755) }},
{{ SC_(1.000000476837158203125), SC_(2097152.577215699622832591533990692770612) }},
Modified: branches/release/libs/math/test/zeta_data.ipp
==============================================================================
--- branches/release/libs/math/test/zeta_data.ipp (original)
+++ branches/release/libs/math/test/zeta_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 200> zeta_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 200> zeta_data = {{
{{ SC_(1.16628754138946533203125), SC_(6.602868183069916948720755731837247651904) }},
{{ SC_(1.28222560882568359375), SC_(4.140637712279411074557164685415721499333) }},
{{ SC_(1.7022221088409423828125), SC_(2.049914055577335303673424130546639695977) }},
Modified: branches/release/libs/math/test/zeta_neg_data.ipp
==============================================================================
--- branches/release/libs/math/test/zeta_neg_data.ipp (original)
+++ branches/release/libs/math/test/zeta_neg_data.ipp 2012-05-14 13:01:32 EDT (Mon, 14 May 2012)
@@ -3,7 +3,7 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- static const boost::array<boost::array<T, 2>, 200> zeta_neg_data = {{
+ static const boost::array<boost::array<typename table_type<T>::type, 2>, 200> zeta_neg_data = {{
{{ SC_(-29.912628173828125), SC_(-11411595.03734503626230312380285630491992) }},
{{ SC_(-29.851711273193359375), SC_(-17491128.83255653477666248263741824395945) }},
{{ SC_(-29.6310367584228515625), SC_(-29338557.80907609522626540806232745245856) }},
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk