Rounding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

is there a way to do rounding up to the nearest tenth? can't use ROUND() cos i need something like this:

6.11 --> 6.2
6.15 --> 6.2
6.19 --> 6.2
6.20 --> 6.2

i know there is a ceil() function but that rounds up to the nearest integer.. i need one decimal place still..

I tried adding a 0.05 to all the numbers and then use round() on them but,

round(6.11+0.05) --> 6.2
round(6.15+0.05) --> 6.2
round(6.19+0.05) --> 6.2
round(6.20+0.05) --> 6.3 (WRONG ANSWER!!)

does anyone have any suggestions for me? please help me!

many thanks,
Hwee

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux