-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Complex numbers #3892
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
base: master
Are you sure you want to change the base?
Complex numbers #3892
Conversation
|
Labeling this T-lang because the desire to make this FFI-compatible is a lang matter. |
|
It's worth pointing out another big issue with this is that the canonical In particular, while I'm not super compelled by the argument that C supports this, therefore the standard library needs to support this. I think that guaranteeing a |
I think that polar form almost always is the more optimal form, at least in my experience. But the ABIs do use rectangular, e.g. from x86:
so it makes sense that an interchange type matches that, and users can translate to/from a polar repr at the FFI boundary if needed. But this reasoning is definitely something to have in the RFC's rationale & alternatives. |
|
Right: I guess my main clarification here was that due to the polar-orthogonal discrepancy, it shouldn't be a canonical Rust type (e.g. |
|
Thanks everyone for the feedback! I have incorporated as much as I can into the RFC. |
Co-authored-by: Trevor Gross <tg@trevorgross.com>
Co-authored-by: Trevor Gross <tg@trevorgross.com>
Removed redundant statement about overhead from libgcc calls and clarified the purpose of the Complex type.
|
Hopefully I've cleared up everything to satisfaction. I suppose it's broadly reasonable to FCP? |
|
The current state of the RFC looks good, thank you! This continues to be a lang/libs-api RFC, lang because of the FFI interoperability with C @rfcbot merge libs-api,lang |
|
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
Co-authored-by: kennytm <kennytm@gmail.com>
Clarify the rationale behind complex number implementation alternatives.
Expanded on the limitations of polar complex numbers and the need for a standard type for FFI with C. Discussed alternatives to complex number representation and their implications.
Added a section discussing alternatives to complex number implementations, including polar layout and non-generic primitive types, while emphasizing the importance of FFI compatibility.
Add considerations for complex number features and compatibility.
|
Commenting on #793 as prior art (it wishes to achieve the same objective, but is largely dead) |
|
Having something to match C99 @rfcbot reviewed (I didn't pay much attention to the API. I trust libs-api will handle that appropriately.) |
I'm ok with this, but I do want to note that this is not seamless. For example, (I probably won't bother with that at all -- just recommending the |
|
Will there be impls for |
Clarify the potential benefits of simplifying Complex number creation and discuss future support for Imaginary and Gaussian integers.
Clarify suggestions for complex number operations and future support.
It was there in an earlier draft, but I decided to relegate it to a future possibility. However, you can see that a related possibility such as the |
This RFC proposes FFI-compatible complex numbers to help scientific computing library authors use non-indirected complexes.
I apologise in advance to
num-complexRendered