[PHP-DEV] Bug #12612 Updated: unsigned integer problem From: jeroen <email protected>
Date: 08/07/01

ID: 12612
Updated by: jeroen
Reported By: dimon <email protected>
Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows 2000 Server SP1 5.0.2195
PHP Version: 4.0.4pl1
New Comment:

PHP 4 handles number-constants smartly. I.e., when a number is out of range of integers, it will be auto-converted to float.

var_dump(0x80000000) -> float(2147483648)

While | requires int-arguments, and because it cannot convert float(2147483648) to int, it will take MAX_INT instead.

That abs(MINIMAL_INT) bug, is a bug which I fixed yesterday (coincidence...)

The 0x80000000 | 0; : apparently

(int) 2147483648.0 => -2147483648
This IS a bug, because it should have been INT_MAX (2147483647)

I'm currently trying to sort that out. By the way, do not put multiple bugs in one report.

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

[2001-08-07 05:10:52] dimon <email protected>

$qq = 0x80000000;
echo $qq; //2147483648 ok
$qq = 0x80000000 | 0;
echo $qq; //-2147483648 ???
echo abs($qq); //-2147483648 ???
echo $qq * -1; //2147483648

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

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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>