#40178 [Bgs]: Differents systems return differents values

From: Date: Sat, 20 Jan 2007 04:08:42 +0000
Subject: #40178 [Bgs]: Differents systems return differents values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107811@lists.php.net to get a copy of this message
ID: 40178 User updated by: bpita at netcombbs dot com Reported By: bpita at netcombbs dot com Status: Bogus Bug Type: *Network Functions Operating System: Win32, Linux32 and Linux64 PHP Version: 5.2.0 New Comment: Thanks, for your answer, I try to understand... but I use an internal function of php that returns differents values depends of my processor architecture ? It's correct ? Not should be the same and Php be in charge of this and return alway the same value independently of the 32b or 64b processor ? Thanks, Bernardo. Previous Comments: ------------------------------------------------------------------------ [2007-01-20 02:15:55] pajoye@php.net (bogus means "Not a bug" here) This is the internal representation of signed integer using unsigned integer. 32bits use one bit for the sign, that explains the negative _displayed_ values, but the internal values are the same. Big numbers should be processed using bcmath or pecl/big_int ------------------------------------------------------------------------ [2007-01-20 00:50:32] bpita at netcombbs dot com Description: ------------ Hi, I use this code in differents operating systems and plataforms (intel and amd) and return differents results. It's a bug ? Any comments ? Thanks, Bernardo. Reproduce code: --------------- echo ip2long('255.255.255.128'); echo ip2long('255.255.255.192'); echo ip2long('255.255.255.248'); Expected result: ---------------- 32 bits systems returns: -128 -64 -8 --------------------- 64 bits systems returns: 4294967168 4294967232 4294967288 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40178&edit=1

« previous php.bugs (#107811) next »