File tree Expand file tree Collapse file tree 3 files changed +5
-6
lines changed
include/boost/decimal/detail/cmath Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -131,14 +131,14 @@ constexpr auto cbrt_impl(const T x) noexcept
131131 (five + gx * (seventy + gx * 56 ))
132132 / (numbers::cbrt2_v<T> * (fourteen + gx * (seventy + gx * 20 )));
133133
134- // Perform 2, 3 or 4 Newton-Raphson iterations depending on precision.
134+ // Perform 3, 4 or 5 Newton-Raphson iterations depending on precision.
135135 // Note from above, we start with slightly more than 2 decimal digits
136136 // of accuracy.
137137
138138 constexpr int iter_loops
139139 {
140- std::numeric_limits<T>::digits10 < 10 ? 2
141- : std::numeric_limits<T>::digits10 < 20 ? 3 : 4
140+ std::numeric_limits<T>::digits10 < 10 ? 3
141+ : std::numeric_limits<T>::digits10 < 20 ? 4 : 5
142142 };
143143
144144 for (int idx = 0 ; idx < iter_loops; ++idx)
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ constexpr auto sqrt_impl(const T x) noexcept
123123 (one + gx * ((one + gx) * 20 ))
124124 / (numbers::sqrt2_v<T> * ((gx * 4 ) * (five + gx) + five));
125125
126- // Perform 2, 3 or 4 Newton-Raphson iterations depending on precision.
126+ // Perform 3, 4 or 5 Newton-Raphson iterations depending on precision.
127127 // Note from above, we start with slightly more than 2 decimal digits
128128 // of accuracy.
129129
Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ auto test() -> void
4343
4444 strm << std::setprecision (std::numeric_limits<boost::decimal::decimal128_t >::digits10)<< cbr;
4545
46- // TODO: This tolerance isn't the best
47- BOOST_TEST_CSTR_EQ (strm.str ().c_str (), " 1.000000000000000000000000000000641" );
46+ BOOST_TEST_CSTR_EQ (strm.str ().c_str (), " 1.000000000000000000000000000000003" );
4847 }
4948
5049 const boost::decimal::decimal128_t lgt { log10 (sum) };
You can’t perform that action at this time.
0 commit comments