[Rails] Re: Maths with in Rails

2011-09-09 Thread Robert Walker
Frederick Cheung wrote in post #1020782: > 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 alw

[Rails] Re: Maths with in Rails

2011-09-09 Thread pepe
Without the code used in the display action it's difficult to know what's going on but I'd guess you're using an integer at some point and that causes loss of precision. On Sep 8, 4:37 am, Eugene de Winnaar wrote: > Hi All > > I have a idea that I am doing and it is working so far but when it > c

[Rails] Re: Maths with in Rails

2011-09-08 Thread Frederick Cheung
On Sep 8, 9:37 am, Eugene de Winnaar 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 integ