forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Imaginary type and IEC 60559-compatible complex arithmetic #1
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
Draft
skirpichev
wants to merge
20
commits into
main
Choose a base branch
from
imaginary-class-109218
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7323971 to
99d1b8c
Compare
4db428d to
6f13b24
Compare
4ca3e9a to
c114f16
Compare
skirpichev
pushed a commit
that referenced
this pull request
Jul 21, 2024
…ython#119498) (#1… (python#119905) Revert "[3.12] pythongh-69214: Fix fcntl.ioctl() request type (python#119498) (python#119505)" This reverts commit 078da88. The change modified how negative values, like termios.TIOCSWINSZ, was treated and is actually backward incompatible.
36c6bf5 to
7e68e91
Compare
6a44153 to
d605b8e
Compare
2c3d2b4 to
db12274
Compare
45dfe36 to
f9edb38
Compare
d56a55c to
d062169
Compare
b9c4ad2 to
1f62ac6
Compare
70419ab to
413dc1d
Compare
Owner
Author
|
Failures for mpmath's test suite on top of this: |
Owner
Author
|
Tests on numpy-2.3.4: |
This reverts commit ca6ab22.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
"Generally, mixed-mode arithmetic combining real and complex variables should be performed directly, not by first coercing the real to complex, lest the sign of zero be rendered uninformative; the same goes for combinations of pure imaginary quantities with complex variables." (c) Kahan, W: Branch cuts for complex elementary functions.
That's why C standards since C99 introduce imaginary types. This patch implements similar extension to the Python language.
Lets consider (actually interrelated) problems, which will be solved on this way.
Now complex arithmetic could be used for implementation of mathematical functions without special "corner cases", with textbooks formulae. Take the inverse tangent as an example:
Previously, we have unsigned imaginary literals with the following semantics:
While this behaviour was well documented, most users would expect instead here:
i.e. that it follows to the rectangular notation for complex numbers.
For example:
The
eval(repr(x)) == xinvariant now holds for the complex type.What's changed:
conjugate()and__getnewargs__()).