Seth Price corrected me (thanks Seth!). I actually only loose one bit
for the sign.

echo (int)pow(2, 31);
> 1073741824


echo (int)pow(2, 32);
> -2147483648


That's certainly a relief. 


I don't know if there are other reasons to have unsigned integers. I
certainly don't mind having it. However it is probably a small issue
since PHP automatically cast large numbers to float anyway.

Thank you all,
Ezra 


--- Begin Message --- It only requires one bit to determine a sign. So a 32 bit integer can represent the same values of a 31 bit unsigned integer.
~Seth

On Feb 9, 2006, at 12:53 PM, Ezra Nugroho wrote:

PHP developers,

Are the requirements for PHP 6 set in stone?

I saw in the minutes from the Paris meeting that a 64bit integer has
been proposed. I am curious if it would make sense to allow integers to
be both signed and unsigned. For me personally, I would love to have
unsigned 64bit integers.

I have a task that requires bitflag operations. Having only 16 bits to
deal with is really bad (I only care about positive int). Having 32
positive bits in PHP 6 is certainly an improvement, but if I can get all
64, then live would be much better.

http://www.php.net/~derick/meeting-notes.html#add-a-64bit-integer

Thanks,
Ezra

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php





--- End Message ---
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to