On Sep 8, 9:37 am, Eugene de Winnaar <[email protected]> wrote:
>
> I am 100% sure the maths is working as I firstly did it on paper and
> took those steps and put them into the action.
>
> When it comes to the display I am superpose to get 2.75 but I only see
> 2 why is that

by default if you are working with integers you'll always get integers
back (by truncation). If you want floating point numbers then you
should convert the numbers you're working with to floating point
numbers first (using to_f), so

5 /2 will always  return 2, but 5.0 / 2 will produce 2.5
>
> I have looked at number_with_precision but rather then getting 2.75 I
> get 2.00

number_with_precision is for formatting a number, you still need to
actually have a number with the floating point component.

Fred
>
> Any Ideas would be appreciated.
>
> Regards

-- 
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