|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-06-08 10:02 UTC] derick@php.net
[2004-06-09 00:07 UTC] dneilsen at davislangdon dot com dot au
[2004-06-09 09:37 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 00:00:02 2025 UTC |
Description: ------------ I have tested this on two separate systems running Redhat 8 and redhat 9 respectively. The Redhat 9 system is running php version 4.3.4 and the redhat 8 is running 4.3.7. php.ini has not been altered and, in the case of the redhat 8 box (php 4.3.7), it was compiled with the following: ./configure --with-mysql --with-apxs=/www/bin/apxs It seems that the bitwise AND operator will not work for values over pow(2,30). In the case of power 31 it returns a negative value and in the case of power 32 and above it returns 0. Thank you for your time :) Regards Daniel Neilsen Reproduce code: --------------- <? for($i=28; $i<34; $i++) { $vala = pow(2,$i); $valb = pow(2,$i); $result = $vala & $valb; echo "$i - $vala & $valb = $result<br>"; } Expected result: ---------------- 28 - 268435456 & 268435456 = 268435456 29 - 536870912 & 536870912 = 536870912 30 - 1073741824 & 1073741824 = 1073741824 31 - 2147483648 & 2147483648 = 2147483648 32 - 4294967296 & 4294967296 = 4294967296 33 - 8589934592 & 8589934592 = 8589934592 Actual result: -------------- 28 - 268435456 & 268435456 = 268435456 29 - 536870912 & 536870912 = 536870912 30 - 1073741824 & 1073741824 = 1073741824 31 - 2147483648 & 2147483648 = -2147483648 32 - 4294967296 & 4294967296 = 0 33 - 8589934592 & 8589934592 = 0