RE: [PHP-GENERAL] Rounding arithmetic results
| From: | Sam Masiello | Date: | Wed, 14 Jun 2000 19:37:17 +0000 |
| Subject: | RE: [PHP-GENERAL] Rounding arithmetic results | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1861@lists.php.net to get a copy of this message | ||
If you wish to receive the next highest number for when you have fractional
values, you can use the ceil() function:
http://www.php.net/manual/function.ceil.php
The round() function will also give you the behavior that you are looking
for:
http://www.php.net/manual/function.round.php
Sam Masiello
System Analyst
Chek.Com
(716) 853-1362 x289
smasiello@chekinc.com
-----Original Message-----
From: Dion Vansevenant [mailto:dion.vansevenant@rowecom.ca]
Sent: Wednesday, June 14, 2000 3:32 PM
To: PHP General
Subject: [PHP-GENERAL] Rounding arithmetic results
I am fairly new to PHP3 so please forgive me if this seems like to
no-brainer to you.
I am working on a little chunk of code that counts the number of pages in a
given area, then divides by 2 to determine how many items to print in each
of two columns of a table.
Works just great when the results are based on an even number of pages, but
odd numbers give me half answers (1.5, 2.5, etc.).
What would be a good method of checking for a half answer and rounding up?
Thanks.
Dion
*************************************************************************
* Dion Vansevenant *
* Systems & Technology Analyst dion.vansevenant@rowecom.ca *
* RoweCom Canada Tel: (519) 472-1005 *
* P.O. Box 2382 Fax: (519) 472-1072 *
* London, ON N6A 5A7 www.rowecom.ca *
* Canada *
*************************************************************************
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net