Skip to content

Conversation

@cxzhong
Copy link
Contributor

@cxzhong cxzhong commented Dec 4, 2025

Fix this error

Failed example:: src/sage/symbolic/expression.pyx#L3299
Failed example:: Exception raised:
Traceback (most recent call last):
File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 734, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1158, in compile_and_execute
exec(compiled, globs)
File "<doctest sage.symbolic.expression.Expression.__bool__[50]>", line 1, in <module>
assert( (Integer(1)+I)*oo == (Integer(2)+Integer(2)*I)*oo )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

The issue is that comparing complex infinities with == can return different results depending on the internal state. The mathematically correct answer is that (1+I)*oo and (2+2*I)*oo should be equal (both represent infinity in the same direction in the complex plane), but the symbolic comparison doesn't always compute this correctly.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@cxzhong cxzhong added the p: CI fix merged before running CI tests label Dec 5, 2025
@cxzhong cxzhong marked this pull request as ready for review December 5, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: CI fix merged before running CI tests s: needs review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant