ID:               16036
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         *Math Functions
 Operating System: Solaris
 PHP Version:      4.1.0
 New Comment:

This is a variation of the commonly asked floating point number
comparison question.  At numbers beyond 2^31-1 pow() returns a float. 
Doing exact comparisons of an integer against a floating point value in
any computer language is tricky because of the way floating point
numbers are represented.  You could make sure your precision is set the
way you want and convert to a string, or apply a fuzz factor.


Previous Comments:
------------------------------------------------------------------------

[2002-03-13 06:20:57] [EMAIL PROTECTED]

var_dump() _ONLY_ works on variables.

------------------------------------------------------------------------

[2002-03-13 06:15:21] [EMAIL PROTECTED]


$a = pow(2,31);
$b = array($a);
var_dump( in_array(2147483648, $b));


$b = array(2147483648);
var_dump( in_array(2147483648, $b));


// this is the result. how come there are different?
bool(false) bool(true) 

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=16036&edit=1

Reply via email to