Paul Jonathan Thompson wrote:
> Hi,
>
> I have this code @accept_ratio = @no_quotes / @no_accepted_quotes. I
> am deviding an integer by an integer but the resultant is not an
> iterger it should be floating to x decimal places. I was under the
> impression that ruby took care of this sort of thing.
>
>  @no_quotes is 551
>  @no_accepted_quotes is 119
>
> I am getting 4 in @accept_ratio which is wrong. It should be 4.63....
> to however many decimal places.
>
> How do I persuade ruby not to chop the decimal off? I would like
> results to 2 decimal places.
>
> Thanks in advance,
>
> Paul Thompson
>
>   
Change one of them to float.  Ruby uses integer arithmetic with integers.


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to