Say hits = 2 and misses = 4. In Ruby, 2/4 = 0. However, 2.0/4.0 = 0.5. Try
those expressions in irb.
To solve your problem, you could convert the numbers to floats: hits.to_f /
misses.to_f = 2.0 / 4.0 = 0.5.
The docs for Number#divmod might be helpful.
http://www.noobkit.com/show/ruby/ruby/ruby-core/numeric/divmod.html
Craig
--~--~---------~--~----~------------~-------~--~----~
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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---