Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199901

Re: [PHP3] size of int = ((2^32) / 2) - 1? From: Sascha Schumann (sas <email protected>)
Date: 01/31/99

On Sun, Jan 31, 1999 at 07:04:07AM -0700, Joey Smith wrote:
>
> Umm...just a little clue? Please? ;) I'm, like, REALLY
> new to all of this. I spend a/b 2 hours a week trying to
> read the K&R,and wish I had more time. Only previous
> programming experience is Applesoft Basic on an
> Apple II GS. I'm still kind of learning how this stuff works.

Well, I'm used to it. Back in the days when the C64 was quite modern, the
number system worked the same way as today. Another method could be:

for($i = 0; $i < ($i + 1); $i++) ;
echo "$i is the biggest number\n";

> I see! Wow, that makes an amazing amount of sense!
> And the #'s go backwards from the sign! So, 2^31 - 1
> positive integers, and 2^31 (+1 or not? or is the extra
> taken by "0"?) negative numbers. If the - 1 is to account
> for the "0", then 0, when not being used in the sense of
> "empty set" or "null", is a Positive #?

Modern math books declare 0 as being a member of the set of natural numbers (I
don't know the exact English expression). With that in mind you have 2^n
positive and 2^n negative numbers in a signed integer with n+1 bits. If you
use the older definition of "positive number", you have (2^n)-1 positive
numbers, 2^n negative and a 0.

> Hmm...Thanks, Sascha. BTW, what time is it in Germany?

You can see it always in the email header ;)

-- 
                     
          Regards,
						                                
                            Sascha Schumann | 
                                 Consultant | finger sas <email protected>
                                            | for PGP public key

-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>