This is a tracking issue for RFC 3892: Complex numbers.
The feature gate for the issue is #![feature(complex_numbers)].
About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Library API
// in core::num
pub struct Complex<T> {
pub re: T,
pub im: T,
}
impl<T> Complex<T> {
pub fn new(re: T, im: T);
}
impl<T: Add<Output = T>> Add<Self> for Complex<T> {
type Output = Complex<T::Output>;
// ...
}
impl<T: Add<Output = T>> Add<T> for Complex<T> {
type Output = Complex<T::Output>;
// ..
}
impl<T: Sub<Output = T>> Sub<Self> for Complex<T> {
type Output = Complex<T::Output>;
// ...
}
impl<T: Sub<Output = T>> Sub<T> for Complex<T> {
type Output = Complex<T::Output>;
// ...
}
Steps
Unresolved Questions
ABI compatibility
On some targets, Clang and GCC deviate on the ABI they use.
For Complex<{ float }>:
For Complex<{ integer }>:
Note that Complex<{ integer }> is a GNU extension, and we don't currently intend to guarantee ABI compatibility for the complex integers a part of the initial stabilization. The compatibility issues are tracked here for completeness.
Precision of Mul
See #154023 (comment).
Related
TODO.
Implementation history
TODO.
cc @scimind2460
This is a tracking issue for RFC 3892: Complex numbers.
The feature gate for the issue is
#![feature(complex_numbers)].About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Library API
Steps
Complextype andrepr(complex)#158885Unresolved Questions
ABI compatibility
On some targets, Clang and GCC deviate on the ABI they use.
For
Complex<{ float }>:_ComplexABI match GCC llvm/llvm-project#212119 (fixed in LLVM 24)_ComplexABI GCC-compatible llvm/llvm-project#208917For
Complex<{ integer }>:_ComplexABI GCC-compatible llvm/llvm-project#212340 (fixed in LLVM 24)_Complexof small integers is different from GCC llvm/llvm-project#214810Note that
Complex<{ integer }>is a GNU extension, and we don't currently intend to guarantee ABI compatibility for the complex integers a part of the initial stabilization. The compatibility issues are tracked here for completeness.Precision of
MulSee #154023 (comment).
Related
TODO.
Implementation history
TODO.
cc @scimind2460