A nice problem. But the singularity provides a domain where a variable loss of precision is observed. Several formulae, which are mathematicaly equivalent and computationaly careful, give distinct results. Guessing the one that was used is the second step of the problem, and maybe the most difficult.