pub fn checked_pow<T>(arg: T, exp: usize) -> Result<T, ProgramError> where
    T: PrimInt + Display