I'm using Qt Creator 2.2.0 based on Qt 4.7.4 (32bit) on Windows 7 Enterprise x64. I can't remember where to find my g++ compiler version. I'm also an engineer by training, so the obvious answer to a programmer is probably the right one.
Given the following code: Made nrows an int for clarity[/edit]
@int npts = 71338;
int nrows = npts*(npts - 1);@
I always get the result 794,071,610. The expected value is 5,089,038,906.
Now, I understand that the maximum range of a 32bit integer is 2^32 (or 4,294,967,296). When I subtract that from the expected value using my trusty TI-82, I get the observed result. This suggests to me that this is a type range issue.
But when I try other data types for nrows @long long, qint64, quint64, int_fast64_t, int_least64_t, __int64@ I get the same result! The only data type I've seen work thus far is a double, but since nrows is a counter I'd prefer to keep it as an integer if possible.
Anyone have an explanation or solution? Thanks!