You are here

function _location_floats_are_equal in GMap Module 5

Epsilon test. Helper function for seeing if two floats are equal. We could use other functions, but all of them belong to libraries that do not come standard with PHP out of the box.

1 call to _location_floats_are_equal()
location_has_coordinates in ./gmap_location.compat.inc

File

./gmap_location.compat.inc, line 15
Backwards compatibility functions for using gmap with Location 2.x.

Code

function _location_floats_are_equal($x, $y) {
  $x = floatval($x);
  $y = floatval($y);
  return abs(max($x, $y) - min($x, $y)) < pow(10, -6);
}