Re: Bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/15/2011 04:07 PM, Igor Escobar wrote:
> Anyone can explain this?
> 
> https://gist.github.com/1220404
> 
> Part of the code are in portuguese so...
> iguais = equal
> diferentes = different
> 
> Regards,
> Igor Escobar
> *Software Engineer
> *
> + http://blog.igorescobar.com
> + http://www.igorescobar.com
> + @igorescobar <http://www.twitter.com/igorescobar>
> 

1. Obviously because of the issues with floating point precision these
are stored as the same float, a la your next example.

2. Using bc math for binary calculations on string representations of a
number overcomes the problems in 1.

3. This one is peculiar, but it seems that since they are numeric
strings that they are being juggled to float for the comparison since
using == there is no type checking.  Using === yields a different
result, presumably because forcing a type check compares them as
strings.  Use strcmp() to overcome this.

4. Do I need to explain this one?

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux