3 unstable releases
0.2.2 | Sep 28, 2022 |
---|---|
0.2.0 | Sep 28, 2022 |
0.1.0 | Sep 28, 2022 |
#1497 in Math
9KB
277 lines
Rust Complex
rust implement for Complex Number
install
cargo add swnb-complex
usage
use swnb_complex::*;
fn main() {
let a = c!(3 + i 2);
let b = c!(2 - i 3);
let c = a * b;
assert_eq!(c, (12, -9 + 4).into());
let c = a + b;
assert_eq!(c, c!(5 - i 1));
let c = a - b;
assert_eq!(c, c!(1 + i 5));
assert_eq!(b - a, -c);
assert_eq!(a / b, (0, 1).into());
}