impl x^y alg