if (x < 0) { return x ** y if y is an integer; calculate n = 1 / y; return nth root of x if n is an odd integer; die "Invalid input", } else { return x ** y; }