x and n should be of type BigInt, which is only supported in NodeJS, Firefox, and Chrome
NCalc
z := PowerN(x, n);
FreePascal (or Delphi) don't come with built-in support for big integers, so you need a 3rd party implementation, such as NCalc in this example. (There are far better big integer implementations for FreePascal/Delphi than this one...)