complex_algebra/complex/
cos.rs1use super::c;
2
3pub trait Cos<T: Copy + PartialEq> {
4 fn cos(z: c<T>) -> c<T>;
5}
6
7#[macro_export]
8macro_rules! cos_macro {
9 ($T:tt) => {
10 impl Cos<$T> for c<$T> {
11 fn cos(z: c<$T>) -> c<$T> {
12 c(0.5, 0.0) * (c::exp(c(0.0, 1.0) * z) + c::exp(c(0.0, -1.0) * z))
13 }
14 }
15 };
16}