php3-list | 199901
Date: 01/31/99
- Next message: Sascha Schumann: "Re: [PHP3] Debugging messages"
- Previous message: Joey Smith: "[PHP3] size of int = ((2^32) / 2) - 1?"
- In reply to: Joey Smith: "[PHP3] size of int = ((2^32) / 2) - 1?"
- Next in thread: Joey Smith: "Re: [PHP3] size of int = ((2^32) / 2) - 1?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Jan 31, 1999 at 05:40:59AM -0700, Joey Smith wrote:
> Rasmus:
> Is the max size of int:
> 2147483647?
It is the biggest number which is representable by using a 32bit signed
integer.
> That's, what, 2 billion or so?
We German say Milliarden :-)
> The best I could figure, that makes it
> ( 2^32 )
> (---------) - 1
> ( 2 )
>
> Am I right?
It's the same as 2^31 - 1
>
> (I just wrote a script that said:
> <?$i = 65537; /* The standard value of an int, right? */
Standard value? 65537 is 2^16 + 1, you probably mean a word... but remember
that there were platforms with 10-bits per byte and 20-bits per word (instead
of 16).
> while (is_int($i)) {$i++;}
> exit;
> ?>
>
> And piped the results to an external file. When it freaked,
> and started printing negatives, I subtracted 1, and tested it.
> It seems right...
>
> A few ?'s...
> Was there an easier way i could have done this?
Yes.
> 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.
--
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>
- Next message: Sascha Schumann: "Re: [PHP3] Debugging messages"
- Previous message: Joey Smith: "[PHP3] size of int = ((2^32) / 2) - 1?"
- In reply to: Joey Smith: "[PHP3] size of int = ((2^32) / 2) - 1?"
- Next in thread: Joey Smith: "Re: [PHP3] size of int = ((2^32) / 2) - 1?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

