Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199901

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

Sascha,

>> Is the max size of int:
>> 2147483647?

>> The best I could figure, that makes it
>> ( 2^32 )
>> (---------) - 1
>> ( 2 )
>>

>It's the same as 2^31 - 1

Hehe. You can tell how good my math skills are, eh?
*sheepish grin* Hey, if math had been my strong suit,
I'd never had gotten my first computer (which was just
a glorified calculator)...If I hadn't been up since Fri.,
I would have seen this. Then again, maybe i wouldn't
have! (That's hard to admit!)

>> A few ?'s...
>> Was there an easier way i could have done this?
>
>Yes.

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.

>
>> Why didn't the script exit when it hit 2147483648,
>> instead of going to -2147483648?
>
>That is the way how signed integer numbers work. The highest bit is used to
>represent signedness.

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 #?

Hmm...Thanks, Sascha. BTW, what time is it in Germany?
It is 7 am, Sunday, Jan. 31st here...Here being Utah, a state
in the western US.
Joey

--
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>