Re: PHP 4.0 Bug #6408: Large integer arithmetic broken

From: Date: Mon, 28 Aug 2000 23:39:21 +0000
Subject: Re: PHP 4.0 Bug #6408: Large integer arithmetic broken
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-31022@lists.php.net to get a copy of this message
<?php $var1 = 3232300816; $var2 = 256; $var3 = $var1 % $var2; print "$var1 % $var2 = $var3"; ?> Output is: 3232300816 % 256 = 0 Correct answer is 16. This appears to be a consistent error, perhaps above the maximum for a 32-bit signed int? Documentation doesn't seem to describe the limits, but this is all 32-bit.
I assume your system does not support 32-bit integers, my windows system works up to 53-bits $var1 = pow(2,53)-1; The manual says: "The size of an integer is platform-dependent, although a maximum value of about 2 billion is the usual value (that's 32 bits signed)." well, maxiumum. it does not guarantee 32.bits, I´d tend to this is not a bug. andré

« previous php.dev (#31022) next »