Using both gdl 0.9.2 and 0.9.4 on a VM with Ubuntu 12.04 guest and Windows7 host (both 64bit) I found:
1)
a=lonarr(3)
a=[8926507,8938828,0]
print,total(a),format='(i)'
17865336
which is wrong because: 8926507+8938828+0=17865335
2)
print,total(a)-1,format='(i)'
17865336
so i obtain total(a)=total(a)-1
3)
total(a) eq 17865335 returns TRUE (e.g. when put in a if-then statement)
BUT if I use two different numbers, the bug vanishes:
4)
a=lonarr(3)
a=[9469071,9272525,0]
print,total(a),format='(i)'
18741596
Finally, defining e.g. a=8926507 and b=8938828, a+b gives the correct result. Moreover, 17865336 eq 17865335 returns FALSE.
I'm quite new to GDL, but it seems to me a total- or lonarr-related bug.
For completeness: I've installed gdl 0.9.2 through apt-get, and gdl 0.9.4 compiling it with cmake, make, make check (all passed) and make install.
Alain C.
2014-03-24
Alain C.
2014-03-24
(IDL gives the same values ...)
Without /preserve, TOTAL() internal computations are made in float.
without format, the result (total(a)) is : 1.78653e+07 which would have inform you of potential problems ...
You can replay with TOTAL( ,/preserve) and re-open a bug report
if other issues found.
Alain