Re: floored by floor()
| From: | Mattias Thorslund | Date: | Thu, 14 Oct 2010 14:22:43 +0000 |
| Subject: | Re: floored by floor() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308701@lists.php.net to get a copy of this message | ||
On 10/13/2010 11:56 PM, gaojian wrote:
在 2010-10-13三的 22:48 -0700,Mattias Thorslund写道:Thanks, I guess I needed to read that again. What confused me here was that var_dump(327.03 * 100) returns the expected value and not something like (float)32702.99999999999999... Cheers, MattiasHi List, I'm having a problem with the behavior of the floor() function: echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!! Sanity check: var_dump(327.03 * 100); //prints "float(32703)" as expected Any ideas why this happens, and how to work around it? Thanks, Mattiasi think u should read the manual about int and float: http://www.php.net/manual/en/language.types.integer.php http://www.php.net/manual/en/language.types.float.php#warn.float-precision jim