> -----Original Message-----
> From: Ratko [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 20, 2001 1:40 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Is this a bug?
> Please try this:
> echo "996448234192168122"=="996448234192168125";
> I get "true" as a result. How's that possible?
> But if I do:
> echo "996448234192168122"==="996448234192168125";
> then I get "false" as expected.
A couple of snippets from the PHP manual:
"The size of an integer is platform-dependent, although a maximum value
of about two billion is the usual value (that's 32 bits signed)...If you
specify a number beyond the bounds of the integer type, it will be
interpreted as a float instead"
"The size of a float is platform-dependent, although a maximum of
~1.8e308 with a precision of roughly 14 decimal digits is a common
value...Never trust floating number results to the last digit, and never
compare floating point numbers for equality. If you really need higher
precision, you should use the arbitrary precision math functions or gmp
Mark Roedel | "Blessed is he who has learned to laugh
Systems Programmer | at himself, for he shall never cease
LeTourneau University | to be entertained."
Longview, Texas, USA | -- John Powell
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]