pub trait Power {
	fn power(self, x: u32) -> Self;
}

//signed
impl Power for i8  { fn power(self, x: u32) -> i8  { self.pow(x) } }
impl Power for i16 { fn power(self, x: u32) -> i16 { self.pow(x) } }
impl Power for i32 { fn power(self, x: u32) -> i32 { self.pow(x) } }
impl Power for i64 { fn power(self, x: u32) -> i64 { self.pow(x) } }

//unsigned
impl Power for u8  { fn power(self, x: u32) -> u8  { self.pow(x) } }
impl Power for u16 { fn power(self, x: u32) -> u16 { self.pow(x) } }
impl Power for u32 { fn power(self, x: u32) -> u32 { self.pow(x) } }
impl Power for u64 { fn power(self, x: u32) -> u64 { self.pow(x) } }

//floating
impl Power for f32 { fn power(self, x: u32) -> f32 { self.powf(x as f32) } }
impl Power for f64 { fn power(self, x: u32) -> f64 { self.powf(x as f64) } }


pub trait SquareRoot {
	fn sq_rt(self) -> Self;
}

//signed
impl SquareRoot for i8  { fn sq_rt(self) -> i8  { (self as f64).sqrt() as i8  } }
impl SquareRoot for i16 { fn sq_rt(self) -> i16 { (self as f64).sqrt() as i16 } }
impl SquareRoot for i32 { fn sq_rt(self) -> i32 { (self as f64).sqrt() as i32 } }
impl SquareRoot for i64 { fn sq_rt(self) -> i64 { (self as f64).sqrt() as i64 } }

//unsigned
impl SquareRoot for u8  { fn sq_rt(self) -> u8  { (self as f64).sqrt() as u8  } }
impl SquareRoot for u16 { fn sq_rt(self) -> u16 { (self as f64).sqrt() as u16 } }
impl SquareRoot for u32 { fn sq_rt(self) -> u32 { (self as f64).sqrt() as u32 } }
impl SquareRoot for u64 { fn sq_rt(self) -> u64 { (self as f64).sqrt() as u64 } }

//floating
impl SquareRoot for f32 { fn sq_rt(self) -> f32 { self.sqrt() } }
impl SquareRoot for f64 { fn sq_rt(self) -> f64 { self.sqrt() } }
