From 63525295e447b09ce7f7dbb2153841da84daf84e Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 21 Jan 2015 17:46:14 +0000 Subject: [PATCH] [Carlson RG] Fix test failures and concept-checking failures. --- .../math/special_functions/ellint_rg.hpp | 4 ++-- test/Jamfile.v2 | 1 + test/compile_test/sf_ellint_rg_incl_test.cpp | 23 +++++++++++++++++++ test/float128/test_carlson.cpp | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 test/compile_test/sf_ellint_rg_incl_test.cpp diff --git a/include/boost/math/special_functions/ellint_rg.hpp b/include/boost/math/special_functions/ellint_rg.hpp index 2f2ce0b5a..0da857a87 100644 --- a/include/boost/math/special_functions/ellint_rg.hpp +++ b/include/boost/math/special_functions/ellint_rg.hpp @@ -69,7 +69,7 @@ namespace boost { namespace math { namespace detail{ { // x = y, z != 0 swap(x, z); - return (x == 0) ? sqrt(z) / 2 : (y * ellint_rc_imp(x, y, pol) + sqrt(x)) / 2; + return (x == 0) ? T(sqrt(z) / 2) : T((y * ellint_rc_imp(x, y, pol) + sqrt(x)) / 2); } } else if(y == z) @@ -77,7 +77,7 @@ namespace boost { namespace math { namespace detail{ if(x == 0) return constants::pi() * sqrt(y) / 4; else - return (y == 0) ? sqrt(x) / 2 : (y * ellint_rc_imp(x, y, pol) + sqrt(x)) / 2; + return (y == 0) ? T(sqrt(x) / 2) : T((y * ellint_rc_imp(x, y, pol) + sqrt(x)) / 2); } return (z * ellint_rf_imp(x, y, z, pol) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index a7779f0f2..21ea4afdc 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -784,6 +784,7 @@ run compile_test/sf_ellint_rc_incl_test.cpp compile_test_main ; run compile_test/sf_ellint_rd_incl_test.cpp compile_test_main ; run compile_test/sf_ellint_rf_incl_test.cpp compile_test_main ; run compile_test/sf_ellint_rj_incl_test.cpp compile_test_main ; +run compile_test/sf_ellint_rg_incl_test.cpp compile_test_main ; run compile_test/sf_erf_incl_test.cpp compile_test_main ; run compile_test/sf_expint_incl_test.cpp compile_test_main ; run compile_test/sf_expm1_incl_test.cpp compile_test_main ; diff --git a/test/compile_test/sf_ellint_rg_incl_test.cpp b/test/compile_test/sf_ellint_rg_incl_test.cpp new file mode 100644 index 000000000..fed70d95a --- /dev/null +++ b/test/compile_test/sf_ellint_rg_incl_test.cpp @@ -0,0 +1,23 @@ +// Copyright John Maddock 2006. +// 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) +// +// Basic sanity check that header +// #includes all the files that it needs to. +// +#include +// +// Note this header includes no other headers, this is +// important if this test is to be meaningful: +// +#include "test_compile_result.hpp" + +void compile_and_link_test() +{ + check_result(boost::math::ellint_rg(f, f, f)); + check_result(boost::math::ellint_rg(d, d, d)); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + check_result(boost::math::ellint_rg(l, l, l)); +#endif +} diff --git a/test/float128/test_carlson.cpp b/test/float128/test_carlson.cpp index ec6699daa..145849373 100644 --- a/test/float128/test_carlson.cpp +++ b/test/float128/test_carlson.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "libs/math/test/test_carlson.hpp" void expected_results()