PHPUnit and floating point precision

Last week I’ve had some trouble unit testing a function that converted a point on a map given in degrees, minutes and seconds, to a longitude and a latitude. I did not write the function myself, but was only unit testing it. PHPUnit gave me some weird output, from which I could not extract a cause. Some mighty debugging got me to the bottom of it.

Continue reading »