|
|
BSD 4.3
procedure large(s)
local a
a := []
s ? {
&pos := 0 # start at right end
while put(a,integer(move(-segsize)))
# add remaining digits
if &pos ~= 1 then put(a,integer(tab(1)))
}
return a
end
procedure add(a1,a2,carry)
local sum
/carry := [0] # default carry
if *a1 = *a2 = 0 then
return if carry[1] ~= 0 then carry else []
if *a1 > *a2 then a1 :=: a2
if *a1 = 0 then return add(carry,a2)
sum := a1[1] + a2[1] + carry[1]
carry := [sum / base]
return push(add(a1[2:0],a2[2:0],carry),sum % base)
end
procedure lstring(a)
local s
s := ""
every s := right(!a,segsize,"0") || s
s ?:= (tab(upto(~'0') | -1) & tab(0))
return s
end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.