Types in C++ for large numbers -
i want calculate number of inversions big array, 200,000 ints, , number quite big. big can't stored in int value.
the answer -8,353,514,212, while simple cases works, think problem type of variable use store number of inversions.
i tried long int , output same, if try double 4.0755e+009 output. don't know problem is.
- use unsigned data type
- use
unsigned long(usually 2^32-1) orunsigned long long(usually 2^64-1)
for full reference see this article.
Comments
Post a Comment