Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
move trait bounds into where clause
  • Loading branch information
PaulXiCao committed Oct 25, 2025
commit 1a0ab93fe51192f5099c7b5e183a0918ade420f5
10 changes: 7 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,9 @@ pub trait DivAdd<Rhs = Self, Addend = Self> {

// (a + i b) / (c + i d) + (e + i f) == [(a + i b) * (c - i d)] / (c*c + d*d) + (e + i f)
// == {(a*c + b*d) + i (-a*d + b*c)} / n + (e + i f) for n=(c*c + d*d)
impl<T: Clone + Num + Mul<Output = T> + MulAdd<Output = T> + Neg<Output = T>> DivAdd<Complex<T>>
for Complex<T>
impl<T> DivAdd<Complex<T>> for Complex<T>
where
T: Clone + Num + Mul<Output = T> + MulAdd<Output = T> + Neg<Output = T>,
{
type Output = Self;

Expand All @@ -848,7 +849,10 @@ impl<T: Clone + Num + Mul<Output = T> + MulAdd<Output = T> + Neg<Output = T>> Di
Self::new(re, im) / n + add
}
}
impl<T: Clone + Num + MulAdd<Output = T> + Neg<Output = T>> DivAdd<&Complex<T>> for &Complex<T> {
impl<T> DivAdd<&Complex<T>> for &Complex<T>
where
T: Clone + Num + Mul<Output = T> + MulAdd<Output = T> + Neg<Output = T>,
{
type Output = Complex<T>;

#[inline]
Expand Down