There is a simpler-looking formulation for the "PMT" !! Here is the most commonly used:
PMT=PV. R.{[1 + R]^N / [1 + R]^N - 1}, where R = Interest RATE.
The "formula" you have doesn't make any sense!! The top "formula" will give you "zero" for an answer!! The bottom "formula" will give you the amount of a LOAN, if you know the payment!!.
I think it is better that you state what the problem, you are trying to solve, is and then we might be able to assist you. The top formula: PV - [FV/(1+i)^N] will always give you a zero, IF you are working on the same problem, because this part [FV/(1+i)^N] gives you PV!!. So, in essence, you are subtracting PV -PV =0 !!. If you are trying to write a code to solve for PV, FV, PMT, i, N, I may refer you to this online financial calculator, which not only can solve for any of the above 5 variables, but also provides the mathematical formulas programmed into it. Here it is:
https://arachnoid.com/finance/