Re: PHP 4.0 Bug #5810 Updated: Arithmetic Operator %

From: Date: Thu, 27 Jul 2000 09:49:17 +0000
Subject: Re: PHP 4.0 Bug #5810 Updated: Arithmetic Operator %
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-26448@lists.php.net to get a copy of this message
echo 0x80000000%0x2; echo 0x80000001%0x2; echo 0x80000002%0x2; echo 0x80000003%0x2; echo 0x80000080%0x100; all above will be 0 and 0xffffffff%0x2=0, but -1%2 will be -1... ----- Original Message ----- From: "Bug Database" <php-dev@lists.php.net> To: <nimrod@ambernet.kiev.ua> Sent: Thursday, July 27, 2000 12:28 PM Subject: PHP 4.0 Bug #5810 Updated: Arithmetic Operator % > Not true. 2147483649 % 3 returns -2. This is because PHP numbers are signed longs. If you want really large numbers, use bcmath extention. Yes.. in this case -2 can be interpreted as 0, but... see examples above.

« previous php.dev (#26448) next »