Skip to content

Commit

Permalink
Merge pull request phayes#101 from namemsile/master
Browse files Browse the repository at this point in the history
Floating point precision
  • Loading branch information
phayes committed Jun 29, 2015
2 parents 211b7a5 + b198ec7 commit 3e37b19
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/geometry/Point.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ public function equals($geometry) {
return FALSE;
}
if (!$this->isEmpty() && !$geometry->isEmpty()) {
return ($this->x() == $geometry->x() && $this->y() == $geometry->y());
/**
* @see: http://php.net/manual/en/function.bccomp.php
* @see: http://php.net/manual/en/language.types.float.php
* @see: http://tubalmartin.github.io/spherical-geometry-php/#LatLng
*/
return (abs($this->x() - $geometry->x()) <= 1.0E-9 && abs($this->y() - $geometry->y()) <= 1.0E-9);
}
else if ($this->isEmpty() && $geometry->isEmpty()) {
return TRUE;
Expand Down

0 comments on commit 3e37b19

Please sign in to comment.