English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi,

I'm calculating two variables $x,$y (both are forced as double).
On PHP5/ServerWindowsNT I'm getting one result and on PHP4/ServerLinux I'm getting another.

PHP 5/Windows
$x =-5867178591
$y=175400
$x ^ $y = -1572120439

PHP 4.4/Linux
$x =-5867178591
$y=175400
$x ^ $y = -2147308248

Why?What can I do to get also on PHP4.4/Linux the same result as on PHP5/Windows?

Many thanks.

2007-11-13 20:50:04 · 1 answers · asked by Dev 1 in Computers & Internet Software

1 answers

XOR is a bitwise operator. And the bit-by-bit representation of a double is OS-dependent.

To make sure you get the same result, use integers.

2007-11-16 14:02:21 · answer #1 · answered by NC 7 · 1 0

fedest.com, questions and answers