#30271 [Com]: Bitwise operator returns unwanted values
| From: | almekind at xs4all dot nl | Date: | Sun, 17 Oct 2004 22:18:40 +0000 |
| Subject: | #30271 [Com]: Bitwise operator returns unwanted values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67699@lists.php.net to get a copy of this message | ||
ID: 30271
Comment by: almekind at xs4all dot nl
Reported By: mccohy at kyberdigi dot cz
Status: Open
Bug Type: Math related
Operating System: Linux
PHP Version: 5.0.2
New Comment:
In php 5.0.1 it was still OK. Came with 5.0.2
Previous Comments:
------------------------------------------------------------------------
[2004-09-29 10:17:53] mccohy at kyberdigi dot cz
Description:
------------
The bitwise operator "and" returns an unwanted value. Here is a simple
example:
Let's store value 924303769 in variable $a and value -2147483649 in
variable $ax. Now, let's count the 'bitwise and' of these two variables
($a & $ax).
PHP 5.0.2 returns zero. PHP 4.3.9 returns 924303769. I am not sure what
happens in 5.0.0 or 5.0.1, sorry.
Reproduce code:
---------------
$a=924303769;
$ax=-2147483649;
echo ($a & $ax)."\n";
Expected result:
----------------
924303769
Actual result:
--------------
0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30271&edit=1