pub fn powf(self, n: Self) -> Self {
        // using x^n = exp(ln(x^n)) = exp(n*ln(x))
        if self >= Self::ZERO {
            (n * self.ln()).exp()
        } else if !n.is_integer() {
            Self::NAN
        } else if n.is_even() {
            // if n is even, then we know that the result will have no sign, so we can remove it
            (n * self.without_sign().ln()).exp()
        } else {
            // if n isn't even, we need to multiply by -1.0 at the end.
            -(n * self.without_sign().ln()).exp()
        }
    }
/// Approximates a number raised to a floating point power.
Approximates a number raised to a floating point power.
Approximates a number raised to a floating point power .
pub fn powf(self, n: Self) -> Self {
        // using x^n = exp(ln(x^n)) = exp(n*ln(x))
        if self >= Self::ZERO {
            (n * self.ln()).exp()
        } else if !n.is_integer() {
            Self::NAN
        } else if n.is_even() {
            // if n is even, then we know that the result will have no sign, so we can remove it
            (n * self.without_sign().ln()).exp()
        } else {
            // if n isn't even, we need to multiply by -1.0 at the end.
            -(n * self.without_sign().ln()).exp()
        }
    }
pub fn powf ( self , n : Self ) -> Self { // using x^n = exp(ln(x^n)) = exp(n*ln(x)) if self >= Self :: ZERO { ( n * self . ln ( ) ) . exp ( ) } else if ! n . is_integer ( ) { Self :: NAN } else if n . is_even ( ) { // if n is even, then we know that the result will have no sign, so we can remove it ( n * self . without_sign ( ) . ln ( ) ) . exp ( ) } else { // if n isn't even, we need to multiply by -1.0 at the end. - ( n * self . without_sign ( ) . ln ( ) ) . exp ( ) } }
Approximates a number raised to a floating point power.
Approximates a number raised to a floating point power .
self
n
Self
self
n
Self