Skip to content

Support mixed scalar inputs in buffered BigInt arithmetic - #364

Merged
blegat merged 1 commit into
jump-dev:masterfrom
ChrisRackauckas-Claude:fix/buffered-bigint-mixed-scalars
Sep 17, 2026
Merged

blegat merged 1 commit into
jump-dev:masterfrom
ChrisRackauckas-Claude:fix/buffered-bigint-mixed-scalars

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

operate!!(-, big(1)//big(2), 1//3) currently throws because buffered BigInt add/sub-multiply has no mixed scalar conversion method. Add the buffered counterpart of the existing unbuffered conversion method, preserving the specialized all-BigInt implementation. The regression tests cover mixed rational arithmetic, variadic multiplication, independent inputs, and buffer/output aliases.

This also resolves two unchanged Symbolics algebra test errors and a partial-fractions doctest error encountered while investigating SciML/MethodOfLines.jl#695. No dependency or public name is added.

Discriminating regression

The same final test/test_big.jl was run on clean master 607eb7f96c4e60977da85f9d982f8f9b5e23bf3e and the patched source, using Julia 1.11.9. The clean worktree contains the new tests but no production fix:

julia +1.11.9 --project=ma-mixed-unfixed-regression -e 'using Pkg; Pkg.instantiate(); include("ma-mixed-unfixed-regression/test/test_big.jl")'
julia +1.11.9 --project=ma-fixed-julia111 -e 'include("ma-fixed-julia111/test/test_big.jl")'

Before, the first new testset fails:

test_Rational_BigInt_mixed_integers | Pass  Fail  Error  Total
                                  |    2     4      6     12
buffered_operate_to!(::BigInt, ::BigInt, sub_mul, ::BigInt, ::Int64, ::BigInt) is not implemented

After, the official file passes all 3,470 assertions across 19 testsets, including:

test_Rational_BigInt_mixed_integers | 12  12
test_buffered_BigInt_mixed_integers | 26  26
test_allocation_Rational_BigInt    | 98  98

The standalone reproducer imports only MutableArithmetics and Test:

using MutableArithmetics, Test
@test MutableArithmetics.operate!!(-, big(1)//big(2), 1//3) == 1//6

An adjacent-commit control with identical dependencies passes 1/1 on a1e23db56a7acdb8764947e2535737349e9a4cf5 and errors on 594afd9, which introduced buffered rational arithmetic in #188.

Full validation

julia +1.11.9 --project=ma-fixed-julia111 -e 'using Pkg; Pkg.test()'
julia +1.12 --project=MutableArithmetics.jl -e 'using Pkg; Pkg.test()'

Both final full suites exited successfully: 30,287 passed, 28 existing broken (30,315 total) on Julia 1.11.9 and 1.12.7. Both include the final 38 new assertions. The separate Julia 1.11 worktree has byte-identical changed source and tests, with a manifest resolved for that Julia version.

  • JuliaFormatter 2, repository configuration, both changed files: passed.
  • typos over the patch and git diff --check: passed.
  • Exact repository Aqua workflow body, including its unchanged ambiguity exclusions: 11/11 checks passed on Julia 1.12.7.
  • Normal docs/make.jl with the repository's strict Documenter configuration: passed on Julia 1.10.12; deployment skipped locally.
  • Unchanged Symbolics partialfractions.jl and laplace.jl, with only the MutableArithmetics source entry changed in the dependency graph: 32 passed/2 errors/3 existing broken before, 34 passed/3 existing broken after.

There is a separate context-dependent allocation failure on unchanged master under Julia 1.12: the targeted BigInt file can report 320 <= 280 as false. The same failure reproduces without this patch; separate controls pass on Julia 1.10, 1.11 and 1.13, and with native package images disabled on Julia 1.12. No compiler-commit attribution or source fix is established. The bound and test order are unchanged; both final full test harnesses pass. This targeted failure is retained in the evidence rather than hidden by an assertion change.

CI platforms and Julia versions beyond the local checks above have not been verified yet. Exact commands, logs, source hashes, the allocation investigation, and the standalone reproducer are archived at https://github.com/ChrisRackauckas/InternalJunk/pull/101.

Please ignore this draft until reviewed by @ChrisRackauckas.

Links

🤖 Generated with Codex CLI 0.154.0 (model: gpt-6-astra; local session ID: 01a099aa-308a-7fd3-91bd-9fb2dc357b91).

Convert Scaling inputs for buffered add/sub-multiply as in the unbuffered
implementation, fixing mixed rational subtraction and preserving aliases.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local session ID 01a099aa-308a-7fd3-91bd-9fb2dc357b91
@ChrisRackauckas

Copy link
Copy Markdown
Contributor

Just a simple conversion. Let me know if this isn't something that is expected to be supported.

@ChrisRackauckas

Copy link
Copy Markdown
Contributor

Bump?

@blegat
blegat marked this pull request as ready for review September 17, 2026 12:16
@blegat

blegat commented Sep 17, 2026

Copy link
Copy Markdown
Member

This looks reasonable thanks for the PR. The format failure seems unrelated, let's fix it in #365.
Let's not worry about the allocation failure 320 <= 280 on Julia v1.12. The test is probably too strict but since it's fixed on Julia v1.13, it won't add noise in ci.

@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.67%. Comparing base (607eb7f) to head (c38e321).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #364   +/-   ##
=======================================
  Coverage   91.66%   91.67%           
=======================================
  Files          23       23           
  Lines        2315     2317    +2     
=======================================
+ Hits         2122     2124    +2     
  Misses        193      193           

☔ View full report in Codecov by Harness.
📢 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
blegat merged commit 287622a into jump-dev:master Sep 17, 2026
9 of 11 checks passed
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.

3 participants