Re: Beware of round() function
| From: | Jeremy Privett | Date: | Mon, 24 Mar 2008 20:04:48 +0000 |
| Subject: | Re: Beware of round() function | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-272056@lists.php.net to get a copy of this message | ||
Jeremy Privett wrote:
Kirk.Johnson@zootweb.com wrote:Also, as a side-note, the only way I've found to get these numbers to print properly is through either printf or sprintf. Also, you could cast back to an integer, if you explicitly don't need floats. -- Jeremy Privett C.E.O. & C.S.A. Omega Vortex Corporation http://www.omegavortex.net Please note: This message has been sent with information that could be confidential and meant only for the intended recipient. If you are not the intended recipient, please delete all copies and inform us of the error as soon as possible. Thank you for your cooperation.Beware: round() apparently has changed its behavior from PHP 4.This is actually a change in the behavior of the float type, not the round function. Replace your round() with a cast to float and you'll see the exact same result.