CUSIP: Difference between revisions

Content added Content deleted
m (diag, +1)
Line 482: Line 482:
cch = repeat(-1,256)
cch = repeat(-1,256)
for i='0' to '9' do
for i='0' to '9' do
cch[i+1] = i-'0'
cch[i] = i-'0'
end for
end for
for i='A' to 'Z' do
for i='A' to 'Z' do
cch[i+1] = i-55
cch[i] = i-55
end for
end for
cch['*'+1] = 36
cch['*'] = 36
cch['@'+1] = 37
cch['@'] = 37
cch['#'+1] = 38
cch['#'] = 38
end if
end if
if length(cusip)!=9 then return 0 end if
if length(cusip)!=9 or find('\0',cusip) then return 0 end if
for i=1 to 8 do
for i=1 to 8 do
c := cusip[i]
c := cusip[i]
v := cch[c+1]
v := cch[c]
if v=-1 then ?{v,c} return 0 end if
if v=-1 then return 0 end if
if remainder(i,2)=0 then
if remainder(i,2)=0 then
v *= 2
v *= 2