Annotation of 43BSD/contrib/icon/book/18/add3.icn, revision 1.1

1.1     ! root        1: record largint(coeff,link)
        !             2: 
        !             3: procedure add(g1,g2,carry)
        !             4:    local sum
        !             5:    /carry := largint(0)        # default carry
        !             6:    if /g1 & /g2 then return if carry.coeff ~= 0 then carry
        !             7:    else &null
        !             8:    if /g1 then return add(carry,g2)
        !             9:    if /g2 then return add(g1,carry)
        !            10:    sum := g1.coeff + g2.coeff + carry.coeff
        !            11:    carry := largint(sum / base)
        !            12:    return largint(sum % base,add(g1.link,g2.link,carry))
        !            13: end
        !            14: 
        !            15: procedure large(s)
        !            16:    if *s <= segsize then return largint(integer(s))
        !            17:    else return largint(right(s,segsize),
        !            18:       large(left(s,*s - segsize)))
        !            19: end
        !            20: 
        !            21: procedure lstring(g)
        !            22:    local s
        !            23:    if /g.link then s := g.coeff
        !            24:    else s := lstring(g.link) || right(g.coeff,segsize,"0")
        !            25:    s ?:= (tab(upto(~'0') | -1) & tab(0))
        !            26:    return s
        !            27: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.