On Thursday 23 December 2004 16:18, Roger Thomas wrote:
> I want to convert negative number to its positive equivalent.
>
> $num = -40;
> printf("Unsigned value is %u", $num);
>
> output is: Unsigned value is 4294967256
>
> I have checked the manpages and %u seems the right format. Pls advise.
You
I believe this is because taking a value and displaying it as an unsigned value
isn't the same as displaying the absolute value of a number.
Ever take a calculator that does hex and decimal, enter a negative number then
convert it to hex? There's no negative in hex, so you end up with something
D]>
To:
Sent: Thursday, December 23, 2004 1:18 AM
Subject: [PHP] stripping negative number
I want to convert negative number to its positive equivalent.
$num = -40;
printf("Unsigned value is %u", $num);
output is: Unsigned value is 4294967256
I have checked the manpages and %
I want to convert negative number to its positive equivalent.
$num = -40;
printf("Unsigned value is %u", $num);
output is: Unsigned value is 4294967256
I have checked the manpages and %u seems the right format. Pls advise.
--
roger
---
Sign Up
4 matches
Mail list logo