NaN return
- From: Josselin <josselin@xxxxxxxxxx>
- Date: Sat, 31 Mar 2007 16:31:05 +0200
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
.
- Follow-Ups:
- Re: NaN return
- From: Luis Parravicini
- Re: NaN return
- Prev by Date: Re: [OT] On banning (Was: New presentation on Ruby)
- Next by Date: Re: compiler for ruby
- Previous by thread: Re: How to crash Ruby by not registering global C variable ?
- Next by thread: Re: NaN return
- Index(es):
Relevant Pages
|