Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix realPart/imaginaryPart/conjugate bugs #3506

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

d-torrance
Copy link
Member

realPart and imaginaryPart expected one of the Number types defined in the interpreter, so failed when given one of the Number types defined at top-level (Constant, InfiniteNumber, IndeterminateNumber).

conjugate assumed that every non-CC Number object was real, and so gave the wrong output when given ii, which is complex but is a Constant object.

We also update the docs and add unit tests.

Before

i1 : realPart ii
stdio:2:8:(3): error: expected a number

i2 : imaginaryPart ii
stdio:3:13:(3): error: expected a number

i3 : conjugate ii

o3 = ii

o3 : Constant

After

i1 : realPart ii

o1 = 0

o1 : RR (of precision 53)

i2 : imaginaryPart ii

o2 = 1

o2 : RR (of precision 53)

i3 : conjugate ii

o3 = -ii

o3 : CC (of precision 53)

Previously, just worked for the ones defined in the interpreter
This fixes previously buggy behavior where "conjugate ii" returned ii.
* Add new methods
* Add realPart/imaginaryPart to each other's SeeAlso sections
* Merge stub "conjugate" node w/ conjugate(CC)
@d-torrance d-torrance requested a review from pzinn October 3, 2024 11:54
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.

1 participant