RE: [PHP-GENERAL] Rounding arithmetic results
| From: | Dion Vansevenant | Date: | Wed, 14 Jun 2000 20:11:06 +0000 |
| Subject: | RE: [PHP-GENERAL] Rounding arithmetic results | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1867@lists.php.net to get a copy of this message | ||
Doh! I searched the online manual for "rounding" but didn't think to look
for round.
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 *
*************************************************************************
> -----Original Message-----
> From: Sam Masiello [mailto:smasiello@chekinc.com]
> Sent: Wednesday, June 14, 2000 15:37
> To: Dion Vansevenant; PHP General
> Subject: RE: [PHP-GENERAL] Rounding arithmetic results
>
>
>
> 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
>