Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1d newton #1000

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added () around min and max
ryanelandt committed Aug 4, 2023

Verified

This commit was signed with the committer’s verified signature.
oliviertassinari Olivier Tassinari
commit 07271f30d676c5f64e5b4e7d11ab05fc9cf602b4
4 changes: 2 additions & 2 deletions include/boost/math/tools/roots.hpp
Original file line number Diff line number Diff line change
@@ -523,7 +523,7 @@ namespace detail {
template <typename U = T>
static typename std::enable_if<std::numeric_limits<U>::is_specialized, T>::type
do_solve(PosFinite x, EqInf X) {
return do_solve(x, PosFinite(std::numeric_limits<U>::max()));
return do_solve(x, PosFinite((std::numeric_limits<U>::max)()));
}
template <typename U = T>
static typename std::enable_if<!std::numeric_limits<U>::is_specialized, T>::type
@@ -539,7 +539,7 @@ namespace detail {
const U denorm_min = std::numeric_limits<U>::denorm_min();
if (denorm_min != 0) { return denorm_min; }

const U min = std::numeric_limits<U>::min();
const U min = (std::numeric_limits<U>::min)();
if (min != 0) { return min; }

BOOST_MATH_ASSERT(false && "denorm_min and min are both zero.");
8 changes: 4 additions & 4 deletions test/test_roots.cpp
Original file line number Diff line number Diff line change
@@ -804,15 +804,15 @@ void test_bisect() {

fn_push_back_pm(v, T(0.0));
fn_push_back_pm(v, std::numeric_limits<T>::denorm_min());
fn_push_back_pm(v, std::numeric_limits<T>::min());
fn_push_back_pm(v, (std::numeric_limits<T>::min)());
fn_push_back_pm(v, std::numeric_limits<T>::epsilon());
const int test_exp_range = 5;
for (int i = -test_exp_range; i < (test_exp_range + 1); ++i) {
const int exponent = i * 3;
const T x = std::ldexp(1.0, exponent);
fn_push_back_pm(v, x);
}
fn_push_back_pm(v, std::numeric_limits<T>::max());
fn_push_back_pm(v, (std::numeric_limits<T>::max)());

// Real_concept doesn't have infinity
if (std::numeric_limits<T>::has_infinity) {
@@ -833,8 +833,8 @@ void test_bisect() {
for (const T& x_j: v) {
const T x_mid_ij = boost::math::tools::detail::Bisection::calc_midpoint(x_i, x_j);

const T x_lo = std::min(x_i, x_j);
const T x_hi = std::max(x_i, x_j);
const T x_lo = (std::min)(x_i, x_j);
const T x_hi = (std::max)(x_i, x_j);

BOOST_CHECK_LE(x_lo, x_mid_ij);
BOOST_CHECK_LE(x_mid_ij, x_hi);