Code:
$tmp = 0xc0211082; $tmp1 = 0xc0000082;
I got doubt when i am converting negative hexadecimal to a decimal number.Please look at mentioned example below.
In the below example my question is when i am converting an hexadecimal to an decimal number i am getting integer overflow in hexadecimal? But the actual values of $tmp & $tmp1 in decimal is signed numbers i.e -1071574910,-1073741694 respectively.
How to manipulate this type of situations?
Code:
$tmp = 0xc0211082;
$tmp1 = 0xc0000082;
$tmp2_dec = hex($tmp);
$tmp3_dec = hex($tmp1);
printf("Decimal Value tmp is %d \n",$tmp);
printf("Decimal Value tmp1 is %d \n",$tmp1);
printf("Decimal Value tmp2 is %d \n",$tmp2_dec);
printf("Decimal Value tmp3 is %d \n",$tmp3_dec);
if($tmp2_dec >0 && $tmp3_dec >0){
print("Temporary values are greater than Zero \n");
}else {
print("Temporary values are less than zero \n");
}
Raghavendra
Comment