The precision of the code isn't very high due to the number of operations done in a permanent evaluation. We might be able to improve this by using [Kahan summation](https://en.wikipedia.org/wiki/Kahan_summation_algorithm) inside loops. It's worth trying.