Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199901

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

Rasmus:
    Is the max size of int:
2147483647?

That's, what, 2 billion or so?

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

Am I right?

(I just wrote a script that said:
<?$i = 65537; /* The standard value of an int, right? */
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?
Why didn't the script exit when it hit 2147483648,
instead of going to -2147483648?
Why that #? Why not follow the ANSI? Any particular
reson?
Am I even right?
What do I win? ;))
 Thanks. I actually had a good time thinking this one
through!

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>