Forum Moderators: coopster

Message Too Old, No Replies

Round-off problems in php

         

Mister_L

2:25 pm on Jul 10, 2009 (gmt 0)

10+ Year Member



I have a program that calculates averages,but for some reason each result I get is rounded to the nearest integer.How can I fix this?

I'm using Apache 1.3.37 with php 5.2.0 and Mysql 5.0.81.

Thanks.

coopster

2:31 pm on Jul 10, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



What function are you using to round and are you setting the precision as you desire?

Mister_L

3:07 pm on Jul 10, 2009 (gmt 0)

10+ Year Member



I'm not using any function to round.I'm not interested in rounding,that's the problem.But I'm not setting the precision also...

coopster

3:38 pm on Jul 10, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You are going to need to offer more details. Where are you doing the calculation? In PHP? MySQL? I assume the numbers are float/real and not integer?

Mister_L

4:16 pm on Jul 10, 2009 (gmt 0)

10+ Year Member



I think problem is solved,thanks anyway.