pub fn pow(&self, exponent: isize) -> Change {
        // Return rounds if the exponent is 0
        if exponent == 0 {
            return Change::rounds(self.stage());
        }

        // Create an accumulator to repeatedly multiply this change into
        let mut accumulator = ChangeAccumulator::new(self.stage());

        if exponent > 0 {
            for _ in 0..exponent as usize {
                accumulator.accumulate(self);
            }
        } else {
            for _ in 0..(-exponent) as usize {
                accumulator.accumulate_inverse(self);
            }
        }

        // Return the total value stored by the accumulator (cloned to stop the value being freed)
        accumulator.total().clone()
    }
/// Raises the contents of this `Change` to a given exponent.  This uses an `O(|n|)` algorithm
/// of repeatedly multiplying the `Change` with itself, which is faster than the (otherwise better)
/// `O(log|n|)` method of repeated squaring for small values of the exponent.  Also allocates
/// on the heap in order to store the intermediate values.
///
/// # Example
/// ```
/// use bellmetal::{Stage, Change};
///
/// let cyclic_part_end = Change::from("81234567");
///
/// assert_eq!(cyclic_part_end.pow(-3), Change::from("45678123"));
/// assert_eq!(cyclic_part_end.pow(2), Change::from("78123456"));
/// assert_eq!(cyclic_part_end.pow(0), Change::rounds(Stage::MAJOR));
/// ```
Raises the contents of this `Change` to a given exponent.
Raises the contents of this ` Change ` to a given exponent .
pub fn pow(&self, exponent: isize) -> Change {
        // Return rounds if the exponent is 0
        if exponent == 0 {
            return Change::rounds(self.stage());
        }
        // Create an accumulator to repeatedly multiply this change into
        let mut accumulator = ChangeAccumulator::new(self.stage());
        if exponent > 0 {
            for _ in 0..exponent as usize {
                accumulator.accumulate(self);
            }
        } else {
            for _ in 0..(-exponent) as usize {
                accumulator.accumulate_inverse(self);
            }
        }
        // Return the total value stored by the accumulator (cloned to stop the value being freed)
        accumulator.total().clone()
    }
pub fn pow ( & self , exponent : isize ) -> Change { // Return rounds if the exponent is 0 if exponent == 0 { return Change :: rounds ( self . stage ( ) ) ; } // Create an accumulator to repeatedly multiply this change into let mut accumulator = ChangeAccumulator :: new ( self . stage ( ) ) ; if exponent > 0 { for _ in 0 .. exponent as usize { accumulator . accumulate ( self ) ; } } else { for _ in 0 .. ( - exponent ) as usize { accumulator . accumulate_inverse ( self ) ; } } // Return the total value stored by the accumulator (cloned to stop the value being freed) accumulator . total ( ) . clone ( ) }
Raises the contents of this `Change` to a given exponent.
Raises the contents of this ` Change ` to a given exponent .
&self
exponent
isize
&self
exponent
isize
example
```
use bellmetal::{Stage, Change}.




` ` ` use bellmetal :: { Stage Change } .