ID:               31569
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at milonic dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Math related
 Operating System: Fedora/Linux 9
 PHP Version:      4.3.10
 New Comment:

Did you compile from source? If so, what are the different GCC versions
on all machines?


Previous Comments:
------------------------------------------------------------------------

[2005-01-16 14:45:20] php at milonic dot com

Narrowed the problem down to this:

$b=251066875;
$a=-3111919630;
echo $b ^= ($a<<10);

     Fedora 3 echos: 251066875 (wrong)
All other OS's echo: 25768443 (correct)

Maybe it helps?

Cheers
Andy

------------------------------------------------------------------------

[2005-01-16 14:34:27] php at milonic dot com

Sorry but it's still the same even with 4.3.11-DEV

My guess is that this could be a Fedora problem but would like to know
either way.

It also seems unrelated to PHP version, happens on all of them both 4
and 5 - It all points to Fedora but just cannot think how.

I'll dig a little deeper and let you know if I find anything

Cheers
Andy

------------------------------------------------------------------------

[2005-01-16 13:05:15] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

------------------------------------------------------------------------

[2005-01-16 12:59:15] php at milonic dot com

Description:
------------
Values returned using the following code produce different results
(incorrect) in PHP-4.3.10 and PHP-4.3.9 on Fedora Core 3. 

When the same code is executed on a Linux 9 or FreeBSD5.3 machine the
values are correct.

Could be a Fedora problem but thought you'd like to take a look.

Reproduce code:
---------------
<?

function fillZeros($a, $b){
        $z = hexdec(80000000);
        if ($z & $a){
                $a = ($a>>1);
                $a &= (~$z);
                $a |= 0x40000000;
                $a = ($a>>($b-1));
        }
        else{
                $a = ($a>>$b);
        }
        return $a;
}



function mixture($a,$b,$c) 
{
        $a -= $b; $a -= $c; $a ^= (fillZeros($c,13));
        $b -= $c; $b -= $a; $b ^= ($a<<8);
        $c -= $a; $c -= $b; $c ^= (fillZeros($b,13));
        $a -= $b; $a -= $c; $a ^= (fillZeros($c,12));
        $b -= $c; $b -= $a; $b ^= ($a<<16);
        $c -= $a; $c -= $b; $c ^= (fillZeros($b,5));
        $a -= $b; $a -= $c; $a ^= (fillZeros($c,3)); 
        $b -= $c; $b -= $a; $b ^= ($a<<10);
        $c -= $a; $c -= $b; $c ^= (fillZeros($b,15));
        return array($a,$b,$c);
}


$test= mixture("11", "22", "33");
echo "$test[0], $test[1], $test[2]\n";

?>

Expected result:
----------------
Should be: 
251066875, -1654377486, -1500734959







Actual result:
--------------
But instead get:
251066875, 1541925888, -402039036

Only happens on Fedora, all other boxes are fine.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31569&edit=1

Reply via email to