Reverted back to my function for finding the nearest gate.
If r was -1, `nearest` would become 1 and the search radius is then 1.
Checking if `r < 0` was faulty because `r` was never changed (So if it was
-1, it would always be less than 0 and cause an update of the nearest
address, regardless of whether the next address was actually nearer.)
Converted distanced in findNearestGate to a double
Merge pull request #56 from Matchlighter/master

Reverted back to my function for finding the nearest gate.