Skip to content

Make Float Integer comparisons more robust - #385

Merged
kwabenantim merged 3 commits into
masterfrom
376-robust-zero-comparisons
Jul 20, 2026
Merged

Make Float Integer comparisons more robust#385
kwabenantim merged 3 commits into
masterfrom
376-robust-zero-comparisons

Conversation

@kwabenantim

@kwabenantim kwabenantim commented Jul 16, 2026

Copy link
Copy Markdown
Member

Description

Make singularity checks robust to Float/Integer equality using is_zero.

Motivation and Context

Supports #376

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Documentation checklist

  • I have updated all documentation in the code where necessary.
  • I have checked spelling in all (new) comments and documentation.
  • I have added a note to RELEASE.md if relevant (new feature, breaking change, or notable bug fix).

Testing

  • Testing is done automatically and codecov shows test coverage
  • This cannot be tested automatically

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c09e4aa) to head (0ae700e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #385   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines         1594      1594           
  Branches       328       328           
=========================================
  Hits          1594      1594           

☔ 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.

@kwabenantim
kwabenantim marked this pull request as ready for review July 17, 2026 14:44
@kwabenantim
kwabenantim requested a review from Copilot July 17, 2026 15:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates singularity detection/fixing logic to use SymPy’s .is_zero semantics instead of direct numeric comparisons, making zero-checks behave consistently across Float vs Integer representations (supporting SymPy 1.13–1.14 per #376).

Changes:

  • Replaced != 0 coefficient checks with not <expr>.is_zero in singularity pattern matching.
  • Made reciprocal detection (1/A) robust by detecting exponent -1 via (exp + 1).is_zero rather than float(exp) == -1.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kwabenantim
kwabenantim requested a review from MichaelClerx July 20, 2026 08:08
@kwabenantim kwabenantim changed the title Make zero-checks robust Make Float Integer checks more robust Jul 20, 2026
@kwabenantim kwabenantim changed the title Make Float Integer checks more robust Make Float Integer comparisons more robust Jul 20, 2026
@kwabenantim
kwabenantim requested a review from mirams July 20, 2026 09:46
@kwabenantim
kwabenantim merged commit dc2f372 into master Jul 20, 2026
23 checks passed
@kwabenantim
kwabenantim deleted the 376-robust-zero-comparisons branch July 20, 2026 10:16
@kwabenantim kwabenantim linked an issue Jul 20, 2026 that may be closed by this pull request
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.

Support sympy 1.13 - 1.14

3 participants