Rounding
| From: | Ng Hwee Hwee | Date: | Thu, 08 Apr 2004 01:56:26 +0000 |
| Subject: | Rounding | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-33791@lists.php.net to get a copy of this message | ||
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