Skip to content

Conversation

@projekter
Copy link
Contributor

I recently saw that MutableArithmetics does not support most of the functions that MPFR offers, only the basic arithmetic and assignment stuff. Actually, I needed it for assignment of (bit) integer values, but when I looked at it, I thought that just implementing the whole bunch of functions is not much more effort once you have a nice macro to automate it.
So in this PR:

  • I implement a macro that creates the function wrappers, replacing the manual repetitive wrappers
  • I rewrite all existing MPFR functions to use this macro
  • I implement most or perhaps even all of the standard functions (i.e., functions that Julia's BigFloat implementation already knows without mutation), where I follow the order of the MPFR documentation

However:

  • There are no tests for this yet (but the existing ones are not broken) - first I would like to know whether you are interested in this functionality at all or whether you think it is too much? After all, the package is called "arithmetics," which you could in a strict sense say is a bit narrower than what this PR does.
  • It would make sense to extend this approach to BigInt, which also has a couple more functions that could be implemented, and also some functions that are at the intersection of GMP and MPFR (setting MPFR Floats from GMP Ints).
  • It would also make sense to include a package extension for SpecialFunctions.jl and implement the functions from there that are part of MPFR.

If you want this to proceed, I think tests should be part of this PR, but the other two points could also be separate...

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 27.00000% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.86%. Comparing base (e00703e) to head (fb41752).

Files with missing lines Patch % Lines
src/implementations/BigFloat.jl 27.00% 73 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #342      +/-   ##
==========================================
- Coverage   89.86%   86.86%   -3.00%     
==========================================
  Files          22       22              
  Lines        2141     2208      +67     
==========================================
- Hits         1924     1918       -6     
- Misses        217      290      +73     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@blegat
Copy link
Member

blegat commented Jan 19, 2026

Yes, I would welcome the addition, the macro makes implementing them quite compact! I would deal with BigInt in a separate PR

@projekter projekter marked this pull request as ready for review January 19, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants