1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
macro_rules! gen_display {
(Complex, [ $($float:ty),+ ]) => (
$(
impl common::fmt::Display for Complex<$float> {
fn fmt(&self, f: &mut common::fmt::Formatter) -> common::fmt::Result {
write!(f, "{} {} {}j", self.real, if self.imag.is_sign_positive() {"+"} else {"-"}, self.imag)
}
}
)+
);
(EComplex, [ $($float:ty),+ ]) => (
$(
impl common::fmt::Display for EComplex<$float> {
fn fmt(&self, f: &mut common::fmt::Formatter) -> common::fmt::Result {
write!(f, "{} · e^({}j)", self.module, self.arg)
}
}
)+
);
}