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 revisionPrevious revision
Next revision
Previous revision
summing_20part_20of_20an_20array [2018/04/17 19:01] – Added syntax highlighting tbest3112summing_20part_20of_20an_20array [2024/01/05 00:21] (current) – external edit 127.0.0.1
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: 2024/01/05 00:16 (external edit)