minlin 0.4.0

Rust library with minimal linear algebra made to be as convinient as possible.
Documentation
use crate::ContainingFloat;

/// Calculate the floating point square root.
pub trait Sqrt {
    type Output;

    /// Calculate the floating point square root.
    fn sqrt(self) -> Self::Output;
}

impl<T> Sqrt for T
where
    T: ContainingFloat,
    T::Float: Sqrt,
{
    type Output = <T::Float as Sqrt>::Output;

    fn sqrt(self) -> Self::Output {
        self.to_float().sqrt()
    }
}

macro_rules! impl_float_sqrt {
    ($($i:ident),*) => {
        $(impl Sqrt for $i {
            type Output = Self;

            fn sqrt(self) -> Self::Output {
                $i::sqrt(self)
            }
        })*
    };
}

impl_float_sqrt!(f32, f64);