User Tools

Site Tools


summing_20part_20of_20an_20array

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
summing_20part_20of_20an_20array [2018/04/17 19:01]
tbest3112 Added syntax highlighting
summing_20part_20of_20an_20array [2021/12/04 17:31] (current)
richardrussell Modified for 64-bit compatibility
Line 11: Line 11:
 <code bb4w> <code bb4w>
         DEF FN_SumPartialArray(d(),​ first%, last%)         DEF FN_SumPartialArray(d(),​ first%, last%)
-        LOCAL I+        LOCAL i%
-        ​I% = ^d(first%)-5 +        ​i%% = ^d(first%)-5 
-        LOCAL ?I%, I%!1, a() +        LOCAL ?i%%, i%%!1, a() 
-        ?I% = 1 : I%!1 = last%-first%+1 +        ?i%% = 1 : i%%!1 = last%-first%+1 
-        ​!^a() = I%+        ​PTR(a()) = i%%
         = SUM(a())         = SUM(a())
 </​code>​ </​code>​
Line 21: Line 21:
 <code bb4w> <code bb4w>
         DEF FN_SumPartialArray(d(),​ first%, last%)         DEF FN_SumPartialArray(d(),​ first%, last%)
-        LOCAL I+        LOCAL i%
-        ​I% = ^d(first%)-5 +        ​i%% = ^d(first%)-5 
-        LOCAL ?I%, I%!1, a()+        LOCAL ?i%%, i%%!1, a()
         ON ERROR LOCAL RESTORE LOCAL : ERROR ERR, REPORT$         ON ERROR LOCAL RESTORE LOCAL : ERROR ERR, REPORT$
-        ?I% = 1 : I%!1 = last%-first%+1 +        ?i%% = 1 : i%%!1 = last%-first%+1 
-        ​!^a() = I%+        ​PTR(a()) = i%%
         = SUM(a())         = SUM(a())
 </​code>​ </​code>​
summing_20part_20of_20an_20array.1523991697.txt.gz · Last modified: 2018/04/17 19:01 by tbest3112