Hi
I am using the pgi compiler and I am decomposing a large number (index) into various separate smaller indexs.
It starts working ok, but then it starts making mistakes after about 16m calculations.
e.g. correct output to start:
1 1 1 0 1 1
2 1 1 0 1 1
3 1 1 0 1 1
4 1 1 0 1 1
5 1 1 0 1 1
6 1 1 0 1 1
7 1 1 0 1 1
8 1 1 0 1 1
9 1 1 0 1 1
10 1 1 0 1 1
11 1 1 0 1 1
12 1 1 0 1 1
13 1 1 0 1 1
14 1 1 0 1 1
15 1 1 0 1 1
16 1 1 0 1 1
17 1 1 0 1 1
18 1 1 0 1 1
19 1 1 0 1 1
20 1 1 0 1 1
then later it breaks and the numbers dont count smoothly anymore. It isnt the maths behind it, so I am assuming it is the compiler?
e.g. broken number list
1 16 6 1 30 11
1 17 6 1 30 11
1 17 6 1 30 11
3 17 6 1 30 11
5 17 6 1 30 11
5 17 6 1 30 11
5 17 6 1 30 11
7 17 6 1 30 11
9 17 6 1 30 11
9 17 6 1 30 11
9 17 6 1 30 11
11 17 6 1 30 11
13 17 6 1 30 11
13 17 6 1 30 11
13 17 6 1 30 11
15 17 6 1 30 11
17 17 6 1 30 11
17 17 6 1 30 11
17 17 6 1 30 11
19 17 6 1 30 11
Anyone have any idea what could be causing it?
Thanks
I have attached my code bellow:
Index = 12*CAPEq*CAPD*CAPBM*(CAPCR+1)*CAPIRCs
DO L = 1, Index
!! extract the categories
floorn = L-1
Eqitr = MOD(FLOOR(floorn), CAPEq)+1
floorn = (L-1)/CAPEq
Debtitr = MOD(FLOOR(floorn), CAPD)+1
floorn = (L-1)/(CAPEq*CAPD)
BMitr = MOD(FLOOR(floorn), CAPBM)+1
floorn = (L-1)/(CAPEq*CAPD*CAPBM)
K = MOD(FLOOR(floorn), (CAPCR+1))
floorn = (L-1)/(CAPEq*CAPD*CAPBM*(CAPCR+1))
IRcat2 = MOD(FLOOR(floorn), CAPIRCs)+1
floorn = (L-1)/(CAPEq*CAPDebt*CAPBM*(CAPCR+1)*CAPIRCs)
R = MOD(FLOOR(floorn), 12)+1
WRITE(3,'(6I3)') Eqitr, Debtitr, BMitr, K, IRcat2, R
ENDDO