Re: Rounding
| From: | Jason Wong | Date: | Thu, 20 Feb 2003 21:29:04 +0000 |
| Subject: | Re: Rounding | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136421@lists.php.net to get a copy of this message | ||
On Friday 21 February 2003 05:17, Van Andel, Robbert wrote:
> How do I round a number to the nearest 10 or even 5. Say I have a
> number like 12. Is there an easy way to round that up to 15 or 20?
To round to the nearest 5:
Divide by 5
Round to the nearest integer
Multiply by 5
I'll leave you to work out how to round to nearest 10.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Man belongs wherever he wants to go.
-- Wernher von Braun
*/