Reputation: 8066
I try to use the codes below to get the abs value of a long long type integer;
long long v=abs(originalValue);
It works as I expected until the value of v exceeds 1073741824 (1G)
If v is 2147482648, abs(v) is -2147482648.
If v is 10737418240, abs(v) is -2147482648 also.
I do not understand what causes these happened.
Welcome any comment
Thanks
interdev
Upvotes: 1
Views: 629