Re: Can someone explain this?
| From: | Adam Voigt | Date: | Tue, 08 Jun 2004 17:11:45 +0000 |
| Subject: | Re: Can someone explain this? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187898@lists.php.net to get a copy of this message | ||
Forgive me if my math is askew, but doesn't the negative imply the
number is signed? If I remember from my C++ days, a declaration of:
unsigned int blah;
Meant you could not store negative numbers in that variable. Hence,
negatives would be signed. No?
On Tue, 2004-06-08 at 12:52, René Fournier wrote:
> $dec = -333371788;
> echo $dec."\n";
>
> $hex = dechex($dec)."\n";
> $dec2 = hexdec($hex)."\n";
>
> echo $dec2."\n";
>
> -= PRODUCES: =-
>
> -333371788
> 3961595508
>
>
> Is this something about signed versus unsigned integers? What I really
> would like to do is convert that negative number (-333371788), which I
> suppose is unsigned to a signed integer (3961595508) without having to
> convert it to hex, then back to decimal.
>
> ....Rene
--
Adam Voigt
adam@kotisprop.com