Re: floored by floor()
| From: | chris h | Date: | Thu, 14 Oct 2010 14:49:43 +0000 |
| Subject: | Re: floored by floor() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308703@lists.php.net to get a copy of this message | ||
floor(32703) is different then floor(327.03 * 100). The former is an int,
while the later is a float. Read those links that were sent :)
Chris.
On Thu, Oct 14, 2010 at 2:14 AM, Glen Fuller <glenmfuller@shaw.ca> wrote:
> On 10/13/2010 10:48 PM, Mattias Thorslund wrote:
>
>> Hi 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,
>>
>> Mattias
>>
>>
>>
> Wouldn't that be equivalent to floor(32703), and since 32703 is the nearest
> integer to 32703 it returns it?
>
> Glen Fuller
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>