>
> If you have two floating point values representing seconds (and parts of)
>> why can't you just compare the two floating point values?
>>
>> What part are you stuck with?  Can you give us some code with a comment on
>> which bit you can't do.
>>
>
>> I don't have a problem with comparing floats, but I might need to find the
> 10 closest times to the actual event time and 4 of those times could be less
> than the actual event time and 6 could be higher.
>
> I don't mind rolling my own and am quite looking forward to it, but I don't
> want to re-invent the proverbial wheel.
>

This seems a fairly simple wheel to be worried about re-inventing though (or
even to look forward to).

OK, so you have an array of times.  You sort through them based on:

(predicted_time - actual_time).abs

and pick the smallest 10 items.

Cheers,


Andy

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to