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 <[email protected]> wrote:
> Hi All
>
> I have a idea that I am doing and it is working so far but when it
> comes to displaying the data that I am getting
> with the maths that I am doing I am not getting the same result.
>
> This is what I have
>
>     @arrived = @worksheet.time_arrived_customer
>     @left = @worksheet.time_left_office
>
>     @left_cust = @worksheet.time_left_customer
>
>     @travel = ((@arrived - @left) * 2)
>     @worked = (@left_cust - @arrived)
>
>     @total = (@travel + @worked) / 60
>
> So what I did was in the DB I am saving the hours in their minute
> form.
>
> 08:00 = 480 min
> 08:15 = 495 min
>
> And so on.
>
> 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
>
> I have looked at number_with_precision but rather then getting 2.75 I
> get 2.00
>
> 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