rust_matrix/
sqrt.rs

1/// A trait created to represent types that expose a
2/// square root method. Relies explicitly on `sqrt`
3pub trait Sqrt {
4    fn square_root(&self) -> Self;
5}
6
7macro_rules! impl_sqrt {
8    ( $($ty:ty),* ) => {
9        $(
10            impl Sqrt for $ty {
11                fn square_root(&self) -> Self {
12                    self.sqrt()
13                }
14            }
15        )*
16    };
17}
18
19impl_sqrt!(f64, f32);