Skip to content

A negation of a signed term is printed in brackets - #2265

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-negation-of-a-signed-number-is-bracketed
Oct 30, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-negation-of-a-signed-number-is-bracketed

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A negation prints as a bare - in front of what it negates. A negative integer was bracketed by its priority, but a negative rational, a negation and +oo print with a sign of their own and were not. A negated term whose print starts with a sign is now bracketed.

2.6.0 and master this branch
"sinh(-5/4)".ToEntity().ToString() (e ^ (-5/4) - e ^ (--5/4)) / 2 (e ^ (-5/4) - e ^ (-(-5/4))) / 2
-(-x) --x -(-x)
-(+oo) -+oo -(+oo)

--5/4 reads back as -(-5) / 4: the same value, a different expression, and easy to misread. NegationOfASignedTermPrintsTest: four cases fail on master, and three pass on both. Suite 18218 passed. The F# wrapper suite, the Mcp, Terminal and InteractiveWrapper suites and the AOT smoke test pass. BoundCheck, RootCheck, CasBench, PropCheck, SimpSweep, RuleCheck, CanonCheck and Confluence are unchanged. Found by a new workspace harness, work/roundtrip.

Fixes #2264.

🤖 Generated with Claude Code

A negation prints as a bare - in front of what it negates. A negative
integer was bracketed by its priority, which is a sum's, but a
negative rational has a quotient's, and a negation and +oo print with
their own sign: -(-2/3) printed as --2/3, which reads back as
-(-2) / 3, and sinh(+oo) as (e ^ +oo - e ^ (-+oo)) / 2. A negated term
whose print starts with a sign is now bracketed.

NegationOfASignedTermPrintsTest prints six negations and reads them
back to their values; three of them, and sinh(-5/4)'s double sign,
fail on master.

Found by work/roundtrip: over 5000 random expressions no print failed
to parse and none read back to another value.

Fixes #2264.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Oct 30, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 30, 2026
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.71%. Comparing base (a17c310) to head (613712d).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2265      +/-   ##
==========================================
+ Coverage   86.69%   86.71%   +0.02%     
==========================================
  Files         310      310              
  Lines       67830    67831       +1     
  Branches    19683    19687       +4     
==========================================
+ Hits        58802    58822      +20     
+ Misses       4910     4892      -18     
+ Partials     4118     4117       -1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.26% <100.00%> (+0.02%) ⬆️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ns/Output/ToString/ToString.Arithmetics.Classes.cs 100.00% <100.00%> (ø)

... and 10 files with indirect coverage changes

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

@Rafael-SOWNet
Rafael-SOWNet merged commit 87a0eff into master Oct 30, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 30, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-negation-of-a-signed-number-is-bracketed branch October 30, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

A negated negative rational prints as --2/3, and a negated +oo as -+oo

1 participant