On 09/15/2011 04:07 PM, Igor Escobar wrote:
> Anyone can explain this?
> Part of the code are in portuguese so...
> iguais = equal
> diferentes = different
> 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?
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php