How do I delete a post? I found the answer in the forums.
---------- Post updated at 12:44 PM ---------- Previous update was at 12:17 PM ----------
According to another post - you will get the negative result. Because while expr working, the result will be stored in internal temporary variable or register then you will get the result.. but that particular temporary variable or register can accomodate only 2147483647 .. if it crosses this limit, you may get the junk value like -ve values... this is my finiding for this issue..
It's because the answer is larger than the largest integer number expr can deal with.
The "bc" command can deal with larger numbers.
echo "2*1024*1024*1024" | bc
2147483648
The "expr" command is limited.
expr 2147483646 + 1
2147483647
expr 2147483647 + 1
-2147483648
A typical limit is 2147483647.
Your value would normally be 2148302046 which is greater
and hence you get the negative, since bits were truncated
from the most significant side of your result.
'bc' will give you the result you want, but you would have to
continue to use 'bc' to do anything useful with that result
other than report it.