What it actually does is not very crucial as far as this question is concerned, but simply put it approximates the value of the Lambert W function using a simplified version of the Newton–Raphson method.

Using convert_to also revealed the reason why it was not stopping after the 8th iteration. The numbers are actually longer than they were being displayed as, so after each iteration they were all different.