NaN return



I am using a method 'distance_to' from a lib returning a distance in Float type based on latitude/longitude

@ proposals.each do | proposal |
cd = proposal.distance_to(current_city)
@d = cd if (@d <=> cd) > 0
end

a problem arise when the proposal latitude/longitude are equivalent to current_city latitude/longitude
in this case it returns NaN (and not 0.0.. don't know why....)
if I don't modify the lib script, how I can get bypass this results (obviously I don't care about 0.0 distance)

something like..
cd = proposal.distance_to(current_city) != NaN ? proposal.distance_to(current_city) : 0.0


.



Relevant Pages

  • Re: finding distance between two points
    ... How distance between two points be calculated, ... say 'geodetic', are you talking latitude/longitude ... hmmm, lat and lon are easy, but with height it gets more ... they are on an elliptical earth model, ...
    (comp.soft-sys.matlab)
  • Re: finding distance between two points
    ... How distance between two points be calculated, ... say 'geodetic', are you talking latitude/longitude ... they are on an elliptical earth model, not a sphere. ...
    (comp.soft-sys.matlab)
  • Re: Looking For Geodetic Python Software
    ... Tim Daneliuk wrote: ... >Is anyone aware of freely available Python modules that can do any of ... >1) Given the latitude/longitude of two locations, compute the distance ...
    (comp.lang.python)
  • Re: Looking For Geodetic Python Software
    ... | 1) Given the latitude/longitude of two locations, compute the distance ... | "Distance" in this case would be either the straight-line ... Stanley C. Kitching ...
    (comp.lang.python)