Skip to content

Conversation

@ckormanyos
Copy link
Member

@ckormanyos ckormanyos commented Feb 2, 2026

This PR reworks and improves the existing sqrt and cbrt impls.

  • For sqrt reduce the argument further to $1/16 < x {\leq} 1/4$ and run the Pade approximation at $1/8$.
  • For cbrt reduce the argument further to $1/64 < x {\leq} 1/8$ and run the Pade approximation at $1/16$.
  • Reduce the loops of Newton iterations on both to $2,3,4$, down from $3,4,5$.
  • Decrease the $128$-bit tolerance of cbrt to expected value.
  • Do some sync-up of the imps sqrt and cbrt.

This is one that I've had planned for a while. I think it's about as good as I'm going to get it with the current technology.

Note that these calculations are still slow and could DEFINITELY use efficiency improvements, for instance with a better initial guess.

@ckormanyos
Copy link
Member Author

Oh hi @mborland I don't know if we are supposed to work in the Alliance repo or Boost. I thought this was in the Alliance, but I'm mistakenly in the boost repo

@ckormanyos
Copy link
Member Author

See also #1311

@ckormanyos
Copy link
Member Author

Looking at the Boost calendar, we have until the 18th for new libs and another week for larger changes. If this one fits, it might be nice. Let's see if it seems stable.

@ckormanyos
Copy link
Member Author

ckormanyos commented Feb 2, 2026

Hi Matt (@mborland) I also added some trial counts to the root tests. So if this unduly bogs down some of the slow runners, then we can walk those changes down.

Do please keep an eye out for anything like excessively increased CI/CD time. I see recent total times arond 3 hours. So we need to see if I added to much to the sanitizers or something weird like that.

@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.8%. Comparing base (be078b6) to head (4f156cd).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #1328     +/-   ##
=========================================
+ Coverage     98.8%   98.8%   +0.1%     
=========================================
  Files          278     278             
  Lines        18013   18034     +21     
  Branches      1916    1918      +2     
=========================================
+ Hits         17790   17813     +23     
+ Misses         223     221      -2     
Files with missing lines Coverage Δ
include/boost/decimal/detail/cmath/cbrt.hpp 100.0% <100.0%> (+1.7%) ⬆️
include/boost/decimal/detail/cmath/sqrt.hpp 100.0% <100.0%> (+2.5%) ⬆️
test/test_cbrt.cpp 100.0% <100.0%> (ø)
test/test_sqrt.cpp 100.0% <100.0%> (ø)

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be078b6...4f156cd. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mborland
Copy link
Member

mborland commented Feb 2, 2026

Oh hi @mborland I don't know if we are supposed to work in the Alliance repo or Boost. I thought this was in the Alliance, but I'm mistakenly in the boost repo

The alliance repo was moved into boost now that we've been accepted and release is coming up. Your access should be exactly the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants