You are here

function _location_floats_are_equal in Location 7.5

Same name and namespace in other branches
  1. 5.3 location.module \_location_floats_are_equal()
  2. 5 location.module \_location_floats_are_equal()
  3. 6.3 location.module \_location_floats_are_equal()
  4. 7.3 location.module \_location_floats_are_equal()
  5. 7.4 location.module \_location_floats_are_equal()

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.

2 calls to _location_floats_are_equal()
location_has_coordinates in ./location.module
Check whether a location has coordinates or not.
location_locationapi in ./location.module
Implements hook_locationapi().

File

./location.module, line 1116
Location module main routines. An implementation of a universal API for location manipulation. Provides functions for postal_code proximity searching, deep-linking into online mapping services. Currently, some options are configured through an…

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);
}