Hi, sorry for stupid newbie question, but can''t google it out: i''d like ''integer1 / integer2'' to return float instead of integer, i.e. in case integer1=5 and integer2=2 the result is 2.5 not 2. the only way i found so far is ''result = 1.0*integer1/integer2'' which i feel is somewhat clumsy thank you very much --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
pepa007 wrote:> Hi, > > sorry for stupid newbie question, but can''t google it out: > > i''d like ''integer1 / integer2'' to return float instead of integer, > i.e. in case integer1=5 and integer2=2 the result is 2.5 not 2. > > the only way i found so far is ''result = 1.0*integer1/integer2'' which > i feel is somewhat clumsy > > thank you very muchinteger1.to_f/integer2 ? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---