This is an integral approximation of the W. Lambert function, the inverse of x*e^x. The integral \frac{x}{\pi}\int_{0}^{\pi}\frac{\left(1-t\cot\left(t\right)\right)^{2}+t^{2}}{x+t\csc\left(t\right)e^{-t\cot\left(t\right)}}dt is an exact formula for W(z), but because integrals are hard to do in scratch (with my knowledge) I just used a summation formula of f(x/n)/n where n is the precision (in this approximation 1000).