Skip to content

Commit

Permalink
Codecov ignore for code not yet in use
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Mar 26, 2024
1 parent 412429a commit 7cad05b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
8 changes: 5 additions & 3 deletions include/boost/decimal/detail/cmath/ellint_1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ constexpr auto ellint_f_impl(T phi, T k) noexcept -> T
invert = true;
}

T result;
T result {};

if (isinf(phi))
{
Expand All @@ -90,7 +90,7 @@ constexpr auto ellint_f_impl(T phi, T k) noexcept -> T
T m = round((phi - rphi) / half_pi);
int s = 1;

if (fmod(m, T(2)) > T(0.5))
if (fmod(m, T{2}) > T{5, -1})
{
m += 1;
s = -1;
Expand All @@ -107,7 +107,7 @@ constexpr auto ellint_f_impl(T phi, T k) noexcept -> T

T cosp = cos(rphi);
cosp *= cosp;
if(sinp > (std::numeric_limits<T>::min)())
if (sinp > (std::numeric_limits<T>::min)())
{
BOOST_DECIMAL_ASSERT(rphi != 0); // precondition, can't be true if sin(rphi) != 0.
//
Expand Down Expand Up @@ -139,6 +139,7 @@ constexpr auto comp_ellint_1(T k) noexcept -> std::enable_if_t<detail::is_decima
return detail::ellint_k_imp(k);
}

/*
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T2>
constexpr auto ellint_1(T1 k, T2 phi) noexcept
-> std::enable_if_t<detail::is_decimal_floating_point_v<T1> &&
Expand All @@ -147,6 +148,7 @@ constexpr auto ellint_1(T1 k, T2 phi) noexcept
using promoted_type = detail::promote_args_t<T1, T2>;
return detail::ellint_f_impl(static_cast<promoted_type>(phi), static_cast<promoted_type>(k));
}
*/

} //namespace decimal
} //namespace boost
Expand Down
5 changes: 5 additions & 0 deletions include/boost/decimal/detail/cmath/impl/ellint_rc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ namespace decimal {
namespace detail {
namespace ellint_impl {

// TODO(mborland): Unblock once ellint_1 is in
// LCOV_EXCL_START

template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
constexpr auto ellint_rc_imp(T x, T y) noexcept
{
Expand Down Expand Up @@ -82,6 +85,8 @@ constexpr auto ellint_rc(T1 x, T2 y) noexcept
return ellint_impl::ellint_rc_imp(static_cast<promoted_type>(x), static_cast<promoted_type>(y));
}

// LCOV_EXCL_STOP

} //namespace detail
} //namespace decimal
} //namespace boost
Expand Down
23 changes: 13 additions & 10 deletions include/boost/decimal/detail/cmath/impl/ellint_rf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ constexpr auto ellint_rf_imp(T x, T y, T z) noexcept
//
// Special cases from http://dlmf.nist.gov/19.20#i
//
if(x == y)
if (x == y)
{
if(x == z)
if (x == z)

Check warning on line 44 in include/boost/decimal/detail/cmath/impl/ellint_rf.hpp

View check run for this annotation

Codecov / codecov/patch

include/boost/decimal/detail/cmath/impl/ellint_rf.hpp#L44

Added line #L44 was not covered by tests
{
// x, y, z equal:
return 1 / sqrt(x);

Check warning on line 47 in include/boost/decimal/detail/cmath/impl/ellint_rf.hpp

View check run for this annotation

Codecov / codecov/patch

include/boost/decimal/detail/cmath/impl/ellint_rf.hpp#L47

Added line #L47 was not covered by tests
Expand All @@ -59,9 +59,9 @@ constexpr auto ellint_rf_imp(T x, T y, T z) noexcept
}
}
}
if(x == z)
if (x == z)
{
if(y == 0)
if (y == 0)

Check warning on line 64 in include/boost/decimal/detail/cmath/impl/ellint_rf.hpp

View check run for this annotation

Codecov / codecov/patch

include/boost/decimal/detail/cmath/impl/ellint_rf.hpp#L64

Added line #L64 was not covered by tests
{
return numbers::pi_v<T> / (2 * sqrt(x));

Check warning on line 66 in include/boost/decimal/detail/cmath/impl/ellint_rf.hpp

View check run for this annotation

Codecov / codecov/patch

include/boost/decimal/detail/cmath/impl/ellint_rf.hpp#L66

Added line #L66 was not covered by tests
}
Expand All @@ -70,9 +70,9 @@ constexpr auto ellint_rf_imp(T x, T y, T z) noexcept
return ellint_rc_imp(y, x);

Check warning on line 70 in include/boost/decimal/detail/cmath/impl/ellint_rf.hpp

View check run for this annotation

Codecov / codecov/patch

include/boost/decimal/detail/cmath/impl/ellint_rf.hpp#L70

Added line #L70 was not covered by tests
}
}
if(y == z)
if (y == z)
{
if(x == 0)
if (x == 0)

Check warning on line 75 in include/boost/decimal/detail/cmath/impl/ellint_rf.hpp

View check run for this annotation

Codecov / codecov/patch

include/boost/decimal/detail/cmath/impl/ellint_rf.hpp#L75

Added line #L75 was not covered by tests
{
return numbers::pi_v<T> / (2 * sqrt(y));

Check warning on line 77 in include/boost/decimal/detail/cmath/impl/ellint_rf.hpp

View check run for this annotation

Codecov / codecov/patch

include/boost/decimal/detail/cmath/impl/ellint_rf.hpp#L77

Added line #L77 was not covered by tests
}
Expand All @@ -82,15 +82,15 @@ constexpr auto ellint_rf_imp(T x, T y, T z) noexcept
}
}

if(x == 0)
if (x == 0)
{
swap(x, z);
}
else if(y == 0)
else if (y == 0)

Check warning on line 89 in include/boost/decimal/detail/cmath/impl/ellint_rf.hpp

View check run for this annotation

Codecov / codecov/patch

include/boost/decimal/detail/cmath/impl/ellint_rf.hpp#L89

Added line #L89 was not covered by tests
{
swap(y, z);
}
if(z == 0)
if (z == 0)
{
//
// Special case for one value zero:
Expand All @@ -110,6 +110,8 @@ constexpr auto ellint_rf_imp(T x, T y, T z) noexcept
return numbers::pi_v<T> / (xn + yn);
}

// TODO(mborland): Unblock once ellint_1 is in
// LCOV_EXCL_START
T xn {x};
T yn {y};
T zn {z};
Expand All @@ -121,7 +123,7 @@ constexpr auto ellint_rf_imp(T x, T y, T z) noexcept

// duplication
unsigned k {1U};
for(; k < 100U; ++k)
for(; k < 1000U; ++k)
{
T root_x {sqrt(xn)};
T root_y {sqrt(yn)};
Expand All @@ -147,6 +149,7 @@ constexpr auto ellint_rf_imp(T x, T y, T z) noexcept
T E2 {X * Y - Z * Z};
T E3 {X * Y * Z};
return (1 + E3 * (T(1) / 14 + 3 * E3 / 104) + E2 * (T(-1) / 10 + E2 / 24 - (3 * E3) / 44 - 5 * E2 * E2 / 208 + E2 * E3 / 16)) / sqrt(An);
// LCOV_EXCL_STOP
}

} //namespace ellint_impl
Expand Down

0 comments on commit 7cad05b

Please sign in to comment.