for a as integer = len1-1 to 0 step -1 val1=*pt1-48 val2=*pt2-48 if val2>=0 then tot = (val1)+(val2)+carry+48 carry=0 if tot >=58 then carry=1 *pta = tot-10 else *pta = tot end if else *pta=46 end if pt1-=1 pt2-=1 pta-=1 next

if carry>0 then answer=str(carry)+answer

return answerend function '================================================== '================================================== Function divide(n1 As String,n2 As String,decimal_places As integer,dpflag As String="s") As String Dim As String number=n1,divisor=n2 dpflag=lcase(dpflag) 'For MOD dim as integer modstop if dpflag="mod" then if len(n1)<len(n2) then return n1 if len(n1)=len(n2) then if n1<n2 then return n1 end if modstop=len(n1)-len(n2)+1 end if if dpflag<>"mod" then If dpflag<>"s" Then dpflag="raw" end if Dim runcount As integer '_______ LOOK UP TABLES ______________ Dim Qmod(0 To 19) As Ubyte Dim bool(0 To 19) As Ubyte For z As Integer=0 To 19 Qmod(z)=(z Mod 10+48) bool(z)=(-(10>z))Next zDim answer As String 'THE ANSWER STRING

'_______ SET THE DECIMAL WHERE IT SHOULD BE AT _______Dim As String part1,part2#macro set(decimal)#macro insert(s,char,position)If position > 0 And position <=Len(s) Thenpart1=Mid$(s,1,position-1)part2=Mid$(s,position)s=part1+char+part2End if#endmacroinsert(answer,".",decpos) answer=thepoint+zeros+answerIf dpflag="raw" Then answer=Mid(answer,1,decimal_places) End if#endmacro'______________________________________________'__________ SPLIT A STRING ABOUT A CHARACTRR __________Dim As String var1,var2 Dim pst As integer #macro split(stri,char,var1,var2) pst=Instr(stri,char) var1="":var2="" If pst<>0 Then var1=Rtrim(Mid(stri,1,pst),".") var2=Ltrim(Mid(stri,pst),".")Else var1=stri End if #endmacro

#macro Removepoint(s) split(s,".",var1,var2)#endmacro'__________ GET THE SIGN AND CLEAR THE -ve __________________Dim sign As String If Left(number,1)="-" Xor Left (divisor,1)="-" Then sign="-" If Left(number,1)="-" Then number=Ltrim(number,"-") If Left (divisor,1)="-" Then divisor=Ltrim(divisor,"-")

'DETERMINE THE DECIMAL POSITION BEFORE THE DIVISIONDim As integer lennint,lenddec,lend,lenn,difflensplit(number,".",var1,var2)lennint=Len(var1)split(divisor,".",var1,var2)lenddec=Len(var2)

If Instr(number,".") Then Removepoint(number) number=var1+var2 End ifIf Instr(divisor,".") Then Removepoint(divisor) divisor=var1+var2 End ifDim As integer numzerosnumzeros=Len(number)number=Ltrim(number,"0"):divisor=Ltrim (divisor,"0")numzeros=numzeros-Len(number)lend=Len(divisor):lenn=Len(number)If lend>lenn Then difflen=lend-lennDim decpos As integer=lenddec+lennint-lend+2-numzeros 'THE POSITION INDICATORDim _sgn As Byte=-Sgn(decpos)If _sgn=0 Then _sgn=1Dim As String thepoint=String(_sgn,".") 'DECIMAL AT START (IF)Dim As String zeros=String(-decpos+1,"0")'ZEROS AT START (IF) e.g. .0009if dpflag<>"mod" thenIf Len(zeros) =0 Then dpflag="s"end ifDim As integer runlengthIf Len(zeros) Then runlength=decimal_places answer=String(Len(zeros)+runlength+10,"0") If dpflag="raw" Then runlength=1 answer=String(Len(zeros)+runlength+10,"0") If decimal_places>Len(zeros) Then runlength=runlength+(decimal_places-Len(zeros)) answer=String(Len(zeros)+runlength+10,"0") End If End If

For n3=lenf-1 To diff Step -1 takeaway= topstring[n3]-divisor[n3-diff]+10-subtractcarry temp[n3]=Qmod(takeaway) subtractcarry=bool(takeaway) Next n3 If subtractcarry=0 Then Exit Do If n3=-1 Then Exit Do For n3=n3 To 0 Step -1 takeaway= topstring[n3]-38-subtractcarry temp[n3]=Qmod(takeaway) subtractcarry=bool(takeaway) if subtractcarry=0 then exit do Next n3 Exit Do

Loop 'single run temp=Ltrim(temp,"0") If temp="" Then temp= "0" topstring=temp Loop Until temp="done" ' INDIVIDUAL CHARACTERS CARVED OFF ________________ runcount=runcount+1 If count=1 Then topstring=copytopstring+Mid(number,lend+runcount,1) Else topstring=copytemp+Mid(number,lend+runcount,1) End If copytopstring=topstring topstring=Ltrim(topstring,"0") if dpflag="mod" then if runcount=modstop then if topstring="" then return "0" return mid(topstring,1,len(topstring)-1) end if end if answer[runcount-1]=count+47 If topstring="" And runcount>Len(n1)+1 Then Exit Do End if Loop Until runcount=runlength+1

' END OF RUN TO REQUIRED DECIMAL PLACES set(decimal) 'PUT IN THE DECIMAL POINT 'THERE IS ALWAYS A DECIMAL POINT SOMEWHERE IN THE ANSWER 'NOW GET RID OF IT IF IT IS REDUNDANT answer=Rtrim(answer,"0") answer=Rtrim(answer,".") answer=Ltrim(answer,"0") If answer="" Then Return "0" Return sign+answerEnd Function '==============================================================================='===============================================================================Function half(fl As String) As String Dim As Ubyte main,carry,temp Dim As String sign , s If Instr(fl,".")=0 Then s=fl+".0" Else s=fl+"0" If Instr(s,"-") Then sign="-":s=Ltrim(s,"-") Dim As String ans=s For z As Integer=0 To Len(s)-1 If s[z]<>46 Then temp=(s[z]-48+carry) main=temp Shr 1 carry=(temp And 1) Shl 3 +(temp And 1) Shl 1 ans[z]=main+48 End If Next z If Instr(ans,".") Then ans=Rtrim(ans,"0") ans=Rtrim(ans,".") ans=Ltrim(ans,"0") Return ansEnd Function'==============================================================================='==============================================================================='Dodicats plus & Minus functions'==============================================================================='=============================================================================== Function plus(_num1 As String,_num2 As String) As String Dim ADDQmod(0 To 19) As Ubyte Dim ADDbool(0 To 19) As Ubyte For z As Integer=0 To 19 ADDQmod(z)=(z Mod 10+48) ADDbool(z)=(-(10<=z)) Next z Var _flag=0,n_=0 Dim As Ubyte addup=Any,addcarry=Any #macro finish() answer=Ltrim(answer,"0") If _flag=1 Then Swap _num2,_num1 Return answer #endmacro If Len(_num2)>Len(_num1) Then Swap _num2,_num1 _flag=1 End If Var diff=Len(_num1)-Len(_num2) Var answer="0"+_num1 addcarry=0 For n_=Len(_num1)-1 To diff Step -1 addup=_num2[n_-diff]+_num1[n_]-96 answer[n_+1]=ADDQmod(addup+addcarry) addcarry=ADDbool(addup+addcarry) Next n_ If addcarry=0 Then finish() End If If n_=-1 Then answer[0]=addcarry+48 finish() Endif For n_=n_ To 0 Step -1 addup=_num1[n_]-48 answer[n_+1]=ADDQmod(addup+addcarry) addcarry=ADDbool(addup+addcarry) If addcarry=0 Then Exit For Next n_ answer[0]=addcarry+48 finish() End Function'==============================================================================='===============================================================================Function minus(NUM1 As String,NUM2 As String) As String 'Dim As String copyfirstnum=mul_num_1,copysecondnum=mul_num_2 Dim As Byte swapflag Dim As Long lenf,lens Dim sign As String * 1 'Dim As String part1,part2 Dim bigger As Byte 'set up tables Dim As Ubyte Qmod(0 To 19) Dim bool(0 To 19) As Ubyte

For z As Integer=0 To 19 Qmod(z)=cubyte(z Mod 10+48) bool(z)=cubyte(-(10>z)) Next z lenf=Len(NUM1) lens=Len(NUM2) #macro compare(numbers) If Lens>lenf Then bigger= -1:Goto fin If Lens<lenf Then bigger =0:Goto fin If NUM2>NUM1 Then bigger=-1 Else bigger= 0 End If fin: #endmacro

compare(numbers) If bigger Then sign="-" Swap NUM2,NUM1 Swap lens,lenf swapflag=1 Endif 'lenf=Len(NUM1) 'lens=Len(NUM2) Dim diff As Long=lenf-lens-Sgn(lenf-lens) Dim As String one,two,three three=NUM1 two=String(lenf-lens,"0")+NUM2 one=NUM1 Dim As Long n2 Dim As Ubyte takeaway,subtractcarry Dim As Ubyte ten=10 'Dim z As Long subtractcarry=0 Do For n2=lenf-1 To diff Step -1 takeaway= one[n2]-two[n2]+ten-subtractcarry three[n2]=Qmod(takeaway) subtractcarry=bool(takeaway) Next n2 If subtractcarry=0 Then Exit Do If n2=-1 Then Exit Do For n2=n2 To 0 Step -1 takeaway= one[n2]-two[n2]+ten-subtractcarry three[n2]=Qmod(takeaway) subtractcarry=bool(takeaway) Next n2 Exit Do Loop

three=Ltrim(three,"0") If three="" Then Return "0" If swapflag=1 Then Swap NUM1,NUM2

Return sign+three

End Function'==============================================================================='===============================================================================function multiplier_7(byref num1 as string, byref num2 as string) as string

'swap numbers so that bigger number is number1 and smaller is number2 if len(number2) > len(number1) then swap number1,number2 if len(number1) = len(number2) then if val(left(number2,1)) > val(left(number1,1)) then swap number1,number2 end if

'begin looping thru strings multiplying do 'set total to zero total = 0 'we are going to be incrementing thru number2 while decrementing thru number1 'working in opposite directions from start1 to stop1 and start2 to stop2 'inc1 works from right to left in the top number1 string 'inc2 works from start2 to stop 2, in the bottom number2 string, decrementing each loop. inc1 = start1 inc2 = start2 do total += *inc1 * *inc2 inc1-= 1 inc2+= 1 loop until inc2 = stop2+1

'each loop we need to decrement stop1 'if stop1 goes negative we reset it to zero and decrement stop2 stop1 -= 1 if stop1 < chk_1 then stop1 += 1 stop2 -=1 if stop2 < chk_2 then stop2+= 1 end if 'each loop we decrement start2 to the left start2 -= 1 'if start2 goes negative we reset it to zero and decrement start1 'start1 is the rightmost digit of number1 we need to multiply if start2 < chk_2 then start2 += 1 start1 -= 1 if start1 < chk_1 then start1+=1 end if

loop until outplace = cptr(ulongint ptr,strptr(answer))+1

'put in the carry at the end if carry > 0 then *outplace = carry else *outplace = 0

for a as integer = len1-1 to 0 step -1 val1=*pt1-48 val2=*pt2-48 if val2>=0 then tot = (val1)+(val2)+carry+48 carry=0 if tot >=58 then carry=1 *pta = tot-10 else *pta = tot end if else *pta=46 end if pt1-=1 pt2-=1 pta-=1 next

if carry>0 then answer=str(carry)+answer

return answerend function '================================================== '================================================== Function divide(n1 As String,n2 As String,decimal_places As integer,dpflag As String="s") As String Dim As String number=n1,divisor=n2 dpflag=lcase(dpflag) 'For MOD dim as integer modstop if dpflag="mod" then if len(n1)<len(n2) then return n1 if len(n1)=len(n2) then if n1<n2 then return n1 end if modstop=len(n1)-len(n2)+1 end if if dpflag<>"mod" then If dpflag<>"s" Then dpflag="raw" end if Dim runcount As integer '_______ LOOK UP TABLES ______________ Dim Qmod(0 To 19) As Ubyte Dim bool(0 To 19) As Ubyte For z As Integer=0 To 19 Qmod(z)=(z Mod 10+48) bool(z)=(-(10>z))Next zDim answer As String 'THE ANSWER STRING

'_______ SET THE DECIMAL WHERE IT SHOULD BE AT _______Dim As String part1,part2#macro set(decimal)#macro insert(s,char,position)If position > 0 And position <=Len(s) Thenpart1=Mid$(s,1,position-1)part2=Mid$(s,position)s=part1+char+part2End if#endmacroinsert(answer,".",decpos) answer=thepoint+zeros+answerIf dpflag="raw" Then answer=Mid(answer,1,decimal_places) End if#endmacro'______________________________________________'__________ SPLIT A STRING ABOUT A CHARACTRR __________Dim As String var1,var2 Dim pst As integer #macro split(stri,char,var1,var2) pst=Instr(stri,char) var1="":var2="" If pst<>0 Then var1=Rtrim(Mid(stri,1,pst),".") var2=Ltrim(Mid(stri,pst),".")Else var1=stri End if #endmacro

#macro Removepoint(s) split(s,".",var1,var2)#endmacro'__________ GET THE SIGN AND CLEAR THE -ve __________________Dim sign As String If Left(number,1)="-" Xor Left (divisor,1)="-" Then sign="-" If Left(number,1)="-" Then number=Ltrim(number,"-") If Left (divisor,1)="-" Then divisor=Ltrim(divisor,"-")

'DETERMINE THE DECIMAL POSITION BEFORE THE DIVISIONDim As integer lennint,lenddec,lend,lenn,difflensplit(number,".",var1,var2)lennint=Len(var1)split(divisor,".",var1,var2)lenddec=Len(var2)

If Instr(number,".") Then Removepoint(number) number=var1+var2 End ifIf Instr(divisor,".") Then Removepoint(divisor) divisor=var1+var2 End ifDim As integer numzerosnumzeros=Len(number)number=Ltrim(number,"0"):divisor=Ltrim (divisor,"0")numzeros=numzeros-Len(number)lend=Len(divisor):lenn=Len(number)If lend>lenn Then difflen=lend-lennDim decpos As integer=lenddec+lennint-lend+2-numzeros 'THE POSITION INDICATORDim _sgn As Byte=-Sgn(decpos)If _sgn=0 Then _sgn=1Dim As String thepoint=String(_sgn,".") 'DECIMAL AT START (IF)Dim As String zeros=String(-decpos+1,"0")'ZEROS AT START (IF) e.g. .0009if dpflag<>"mod" thenIf Len(zeros) =0 Then dpflag="s"end ifDim As integer runlengthIf Len(zeros) Then runlength=decimal_places answer=String(Len(zeros)+runlength+10,"0") If dpflag="raw" Then runlength=1 answer=String(Len(zeros)+runlength+10,"0") If decimal_places>Len(zeros) Then runlength=runlength+(decimal_places-Len(zeros)) answer=String(Len(zeros)+runlength+10,"0") End If End If

For n3=lenf-1 To diff Step -1 takeaway= topstring[n3]-divisor[n3-diff]+10-subtractcarry temp[n3]=Qmod(takeaway) subtractcarry=bool(takeaway) Next n3 If subtractcarry=0 Then Exit Do If n3=-1 Then Exit Do For n3=n3 To 0 Step -1 takeaway= topstring[n3]-38-subtractcarry temp[n3]=Qmod(takeaway) subtractcarry=bool(takeaway) if subtractcarry=0 then exit do Next n3 Exit Do

Loop 'single run temp=Ltrim(temp,"0") If temp="" Then temp= "0" topstring=temp Loop Until temp="done" ' INDIVIDUAL CHARACTERS CARVED OFF ________________ runcount=runcount+1 If count=1 Then topstring=copytopstring+Mid(number,lend+runcount,1) Else topstring=copytemp+Mid(number,lend+runcount,1) End If copytopstring=topstring topstring=Ltrim(topstring,"0") if dpflag="mod" then if runcount=modstop then if topstring="" then return "0" return mid(topstring,1,len(topstring)-1) end if end if answer[runcount-1]=count+47 If topstring="" And runcount>Len(n1)+1 Then Exit Do End if Loop Until runcount=runlength+1

' END OF RUN TO REQUIRED DECIMAL PLACES set(decimal) 'PUT IN THE DECIMAL POINT 'THERE IS ALWAYS A DECIMAL POINT SOMEWHERE IN THE ANSWER 'NOW GET RID OF IT IF IT IS REDUNDANT answer=Rtrim(answer,"0") answer=Rtrim(answer,".") answer=Ltrim(answer,"0") If answer="" Then Return "0" Return sign+answerEnd Function '==============================================================================='===============================================================================Function half(fl As String) As String Dim As Ubyte main,carry,temp Dim As String sign , s If Instr(fl,".")=0 Then s=fl+".0" Else s=fl+"0" If Instr(s,"-") Then sign="-":s=Ltrim(s,"-") Dim As String ans=s For z As Integer=0 To Len(s)-1 If s[z]<>46 Then temp=(s[z]-48+carry) main=temp Shr 1 carry=(temp And 1) Shl 3 +(temp And 1) Shl 1 ans[z]=main+48 End If Next z If Instr(ans,".") Then ans=Rtrim(ans,"0") ans=Rtrim(ans,".") ans=Ltrim(ans,"0") Return ansEnd Function'==============================================================================='==============================================================================='Dodicats plus & Minus functions'==============================================================================='=============================================================================== Function plus(_num1 As String,_num2 As String) As String Dim ADDQmod(0 To 19) As Ubyte Dim ADDbool(0 To 19) As Ubyte For z As Integer=0 To 19 ADDQmod(z)=(z Mod 10+48) ADDbool(z)=(-(10<=z)) Next z Var _flag=0,n_=0 Dim As Ubyte addup=Any,addcarry=Any #macro finish() answer=Ltrim(answer,"0") If _flag=1 Then Swap _num2,_num1 Return answer #endmacro If Len(_num2)>Len(_num1) Then Swap _num2,_num1 _flag=1 End If Var diff=Len(_num1)-Len(_num2) Var answer="0"+_num1 addcarry=0 For n_=Len(_num1)-1 To diff Step -1 addup=_num2[n_-diff]+_num1[n_]-96 answer[n_+1]=ADDQmod(addup+addcarry) addcarry=ADDbool(addup+addcarry) Next n_ If addcarry=0 Then finish() End If If n_=-1 Then answer[0]=addcarry+48 finish() Endif For n_=n_ To 0 Step -1 addup=_num1[n_]-48 answer[n_+1]=ADDQmod(addup+addcarry) addcarry=ADDbool(addup+addcarry) If addcarry=0 Then Exit For Next n_ answer[0]=addcarry+48 finish() End Function'==============================================================================='===============================================================================Function minus(NUM1 As String,NUM2 As String) As String 'Dim As String copyfirstnum=mul_num_1,copysecondnum=mul_num_2 Dim As Byte swapflag Dim As Long lenf,lens Dim sign As String * 1 'Dim As String part1,part2 Dim bigger As Byte 'set up tables Dim As Ubyte Qmod(0 To 19) Dim bool(0 To 19) As Ubyte

For z As Integer=0 To 19 Qmod(z)=cubyte(z Mod 10+48) bool(z)=cubyte(-(10>z)) Next z lenf=Len(NUM1) lens=Len(NUM2) #macro compare(numbers) If Lens>lenf Then bigger= -1:Goto fin If Lens<lenf Then bigger =0:Goto fin If NUM2>NUM1 Then bigger=-1 Else bigger= 0 End If fin: #endmacro

compare(numbers) If bigger Then sign="-" Swap NUM2,NUM1 Swap lens,lenf swapflag=1 Endif 'lenf=Len(NUM1) 'lens=Len(NUM2) Dim diff As Long=lenf-lens-Sgn(lenf-lens) Dim As String one,two,three three=NUM1 two=String(lenf-lens,"0")+NUM2 one=NUM1 Dim As Long n2 Dim As Ubyte takeaway,subtractcarry Dim As Ubyte ten=10 'Dim z As Long subtractcarry=0 Do For n2=lenf-1 To diff Step -1 takeaway= one[n2]-two[n2]+ten-subtractcarry three[n2]=Qmod(takeaway) subtractcarry=bool(takeaway) Next n2 If subtractcarry=0 Then Exit Do If n2=-1 Then Exit Do For n2=n2 To 0 Step -1 takeaway= one[n2]-two[n2]+ten-subtractcarry three[n2]=Qmod(takeaway) subtractcarry=bool(takeaway) Next n2 Exit Do Loop

three=Ltrim(three,"0") If three="" Then Return "0" If swapflag=1 Then Swap NUM1,NUM2

Return sign+three

End Function'==============================================================================='===============================================================================function multiplier_7(byref num1 as string, byref num2 as string) as string

'swap numbers so that bigger number is number1 and smaller is number2 if len(number2) > len(number1) then swap number1,number2 if len(number1) = len(number2) then if val(left(number2,1)) > val(left(number1,1)) then swap number1,number2 end if

'begin looping thru strings multiplying do 'set total to zero total = 0 'we are going to be incrementing thru number2 while decrementing thru number1 'working in opposite directions from start1 to stop1 and start2 to stop2 'inc1 works from right to left in the top number1 string 'inc2 works from start2 to stop 2, in the bottom number2 string, decrementing each loop. inc1 = start1 inc2 = start2 do total += *inc1 * *inc2 inc1-= 1 inc2+= 1 loop until inc2 = stop2+1

'each loop we need to decrement stop1 'if stop1 goes negative we reset it to zero and decrement stop2 stop1 -= 1 if stop1 < chk_1 then stop1 += 1 stop2 -=1 if stop2 < chk_2 then stop2+= 1 end if 'each loop we decrement start2 to the left start2 -= 1 'if start2 goes negative we reset it to zero and decrement start1 'start1 is the rightmost digit of number1 we need to multiply if start2 < chk_2 then start2 += 1 start1 -= 1 if start1 < chk_1 then start1+=1 end if

loop until outplace = cptr(ulongint ptr,strptr(answer))+1

'put in the carry at the end if carry > 0 then *outplace = carry else *outplace = 0

for a as integer = len1-1 to 0 step -1 val1=*pt1-48 val2=*pt2-48 if val2>=0 then tot = (val1)+(val2)+carry+48 carry=0 if tot >=58 then carry=1 *pta = tot-10 else *pta = tot end if else *pta=46 end if pt1-=1 pt2-=1 pta-=1 next

if carry>0 then answer=str(carry)+answer

return answerend function '================================================== '================================================== Function divide(n1 As String,n2 As String,decimal_places As integer,dpflag As String="s") As String Dim As String number=n1,divisor=n2 dpflag=lcase(dpflag) 'For MOD dim as integer modstop if dpflag="mod" then if len(n1)<len(n2) then return n1 if len(n1)=len(n2) then if n1<n2 then return n1 end if modstop=len(n1)-len(n2)+1 end if if dpflag<>"mod" then If dpflag<>"s" Then dpflag="raw" end if Dim runcount As integer '_______ LOOK UP TABLES ______________ Dim Qmod(0 To 19) As Ubyte Dim bool(0 To 19) As Ubyte For z As Integer=0 To 19 Qmod(z)=(z Mod 10+48) bool(z)=(-(10>z))Next zDim answer As String 'THE ANSWER STRING

'_______ SET THE DECIMAL WHERE IT SHOULD BE AT _______Dim As String part1,part2#macro set(decimal)#macro insert(s,char,position)If position > 0 And position <=Len(s) Thenpart1=Mid$(s,1,position-1)part2=Mid$(s,position)s=part1+char+part2End if#endmacroinsert(answer,".",decpos) answer=thepoint+zeros+answerIf dpflag="raw" Then answer=Mid(answer,1,decimal_places) End if#endmacro'______________________________________________'__________ SPLIT A STRING ABOUT A CHARACTRR __________Dim As String var1,var2 Dim pst As integer #macro split(stri,char,var1,var2) pst=Instr(stri,char) var1="":var2="" If pst<>0 Then var1=Rtrim(Mid(stri,1,pst),".") var2=Ltrim(Mid(stri,pst),".")Else var1=stri End if #endmacro

#macro Removepoint(s) split(s,".",var1,var2)#endmacro'__________ GET THE SIGN AND CLEAR THE -ve __________________Dim sign As String If Left(number,1)="-" Xor Left (divisor,1)="-" Then sign="-" If Left(number,1)="-" Then number=Ltrim(number,"-") If Left (divisor,1)="-" Then divisor=Ltrim(divisor,"-")

'DETERMINE THE DECIMAL POSITION BEFORE THE DIVISIONDim As integer lennint,lenddec,lend,lenn,difflensplit(number,".",var1,var2)lennint=Len(var1)split(divisor,".",var1,var2)lenddec=Len(var2)

If Instr(number,".") Then Removepoint(number) number=var1+var2 End ifIf Instr(divisor,".") Then Removepoint(divisor) divisor=var1+var2 End ifDim As integer numzerosnumzeros=Len(number)number=Ltrim(number,"0"):divisor=Ltrim (divisor,"0")numzeros=numzeros-Len(number)lend=Len(divisor):lenn=Len(number)If lend>lenn Then difflen=lend-lennDim decpos As integer=lenddec+lennint-lend+2-numzeros 'THE POSITION INDICATORDim _sgn As Byte=-Sgn(decpos)If _sgn=0 Then _sgn=1Dim As String thepoint=String(_sgn,".") 'DECIMAL AT START (IF)Dim As String zeros=String(-decpos+1,"0")'ZEROS AT START (IF) e.g. .0009if dpflag<>"mod" thenIf Len(zeros) =0 Then dpflag="s"end ifDim As integer runlengthIf Len(zeros) Then runlength=decimal_places answer=String(Len(zeros)+runlength+10,"0") If dpflag="raw" Then runlength=1 answer=String(Len(zeros)+runlength+10,"0") If decimal_places>Len(zeros) Then runlength=runlength+(decimal_places-Len(zeros)) answer=String(Len(zeros)+runlength+10,"0") End If End If

For n3=lenf-1 To diff Step -1 takeaway= topstring[n3]-divisor[n3-diff]+10-subtractcarry temp[n3]=Qmod(takeaway) subtractcarry=bool(takeaway) Next n3 If subtractcarry=0 Then Exit Do If n3=-1 Then Exit Do For n3=n3 To 0 Step -1 takeaway= topstring[n3]-38-subtractcarry temp[n3]=Qmod(takeaway) subtractcarry=bool(takeaway) if subtractcarry=0 then exit do Next n3 Exit Do

Loop 'single run temp=Ltrim(temp,"0") If temp="" Then temp= "0" topstring=temp Loop Until temp="done" ' INDIVIDUAL CHARACTERS CARVED OFF ________________ runcount=runcount+1 If count=1 Then topstring=copytopstring+Mid(number,lend+runcount,1) Else topstring=copytemp+Mid(number,lend+runcount,1) End If copytopstring=topstring topstring=Ltrim(topstring,"0") if dpflag="mod" then if runcount=modstop then if topstring="" then return "0" return mid(topstring,1,len(topstring)-1) end if end if answer[runcount-1]=count+47 If topstring="" And runcount>Len(n1)+1 Then Exit Do End if Loop Until runcount=runlength+1

' END OF RUN TO REQUIRED DECIMAL PLACES set(decimal) 'PUT IN THE DECIMAL POINT 'THERE IS ALWAYS A DECIMAL POINT SOMEWHERE IN THE ANSWER 'NOW GET RID OF IT IF IT IS REDUNDANT answer=Rtrim(answer,"0") answer=Rtrim(answer,".") answer=Ltrim(answer,"0") If answer="" Then Return "0" Return sign+answerEnd Function '==============================================================================='===============================================================================Function half(fl As String) As String Dim As Ubyte main,carry,temp Dim As String sign , s If Instr(fl,".")=0 Then s=fl+".0" Else s=fl+"0" If Instr(s,"-") Then sign="-":s=Ltrim(s,"-") Dim As String ans=s For z As Integer=0 To Len(s)-1 If s[z]<>46 Then temp=(s[z]-48+carry) main=temp Shr 1 carry=(temp And 1) Shl 3 +(temp And 1) Shl 1 ans[z]=main+48 End If Next z If Instr(ans,".") Then ans=Rtrim(ans,"0") ans=Rtrim(ans,".") ans=Ltrim(ans,"0") Return ansEnd Function'==============================================================================='==============================================================================='Dodicats plus & Minus functions'==============================================================================='=============================================================================== Function plus(_num1 As String,_num2 As String) As String Dim ADDQmod(0 To 19) As Ubyte Dim ADDbool(0 To 19) As Ubyte For z As Integer=0 To 19 ADDQmod(z)=(z Mod 10+48) ADDbool(z)=(-(10<=z)) Next z Var _flag=0,n_=0 Dim As Ubyte addup=Any,addcarry=Any #macro finish() answer=Ltrim(answer,"0") If _flag=1 Then Swap _num2,_num1 Return answer #endmacro If Len(_num2)>Len(_num1) Then Swap _num2,_num1 _flag=1 End If Var diff=Len(_num1)-Len(_num2) Var answer="0"+_num1 addcarry=0 For n_=Len(_num1)-1 To diff Step -1 addup=_num2[n_-diff]+_num1[n_]-96 answer[n_+1]=ADDQmod(addup+addcarry) addcarry=ADDbool(addup+addcarry) Next n_ If addcarry=0 Then finish() End If If n_=-1 Then answer[0]=addcarry+48 finish() Endif For n_=n_ To 0 Step -1 addup=_num1[n_]-48 answer[n_+1]=ADDQmod(addup+addcarry) addcarry=ADDbool(addup+addcarry) If addcarry=0 Then Exit For Next n_ answer[0]=addcarry+48 finish() End Function'==============================================================================='===============================================================================Function minus(NUM1 As String,NUM2 As String) As String 'Dim As String copyfirstnum=mul_num_1,copysecondnum=mul_num_2 Dim As Byte swapflag Dim As Long lenf,lens Dim sign As String * 1 'Dim As String part1,part2 Dim bigger As Byte 'set up tables Dim As Ubyte Qmod(0 To 19) Dim bool(0 To 19) As Ubyte

For z As Integer=0 To 19 Qmod(z)=cubyte(z Mod 10+48) bool(z)=cubyte(-(10>z)) Next z lenf=Len(NUM1) lens=Len(NUM2) #macro compare(numbers) If Lens>lenf Then bigger= -1:Goto fin If Lens<lenf Then bigger =0:Goto fin If NUM2>NUM1 Then bigger=-1 Else bigger= 0 End If fin: #endmacro

compare(numbers) If bigger Then sign="-" Swap NUM2,NUM1 Swap lens,lenf swapflag=1 Endif 'lenf=Len(NUM1) 'lens=Len(NUM2) Dim diff As Long=lenf-lens-Sgn(lenf-lens) Dim As String one,two,three three=NUM1 two=String(lenf-lens,"0")+NUM2 one=NUM1 Dim As Long n2 Dim As Ubyte takeaway,subtractcarry Dim As Ubyte ten=10 'Dim z As Long subtractcarry=0 Do For n2=lenf-1 To diff Step -1 takeaway= one[n2]-two[n2]+ten-subtractcarry three[n2]=Qmod(takeaway) subtractcarry=bool(takeaway) Next n2 If subtractcarry=0 Then Exit Do If n2=-1 Then Exit Do For n2=n2 To 0 Step -1 takeaway= one[n2]-two[n2]+ten-subtractcarry three[n2]=Qmod(takeaway) subtractcarry=bool(takeaway) Next n2 Exit Do Loop

three=Ltrim(three,"0") If three="" Then Return "0" If swapflag=1 Then Swap NUM1,NUM2

Return sign+three

End Function'==============================================================================='===============================================================================function multiplier_7(byref num1 as string, byref num2 as string) as string

'swap numbers so that bigger number is number1 and smaller is number2 if len(number2) > len(number1) then swap number1,number2 if len(number1) = len(number2) then if val(left(number2,1)) > val(left(number1,1)) then swap number1,number2 end if

'begin looping thru strings multiplying do 'set total to zero total = 0 'we are going to be incrementing thru number2 while decrementing thru number1 'working in opposite directions from start1 to stop1 and start2 to stop2 'inc1 works from right to left in the top number1 string 'inc2 works from start2 to stop 2, in the bottom number2 string, decrementing each loop. inc1 = start1 inc2 = start2 do total += *inc1 * *inc2 inc1-= 1 inc2+= 1 loop until inc2 = stop2+1

'each loop we need to decrement stop1 'if stop1 goes negative we reset it to zero and decrement stop2 stop1 -= 1 if stop1 < chk_1 then stop1 += 1 stop2 -=1 if stop2 < chk_2 then stop2+= 1 end if 'each loop we decrement start2 to the left start2 -= 1 'if start2 goes negative we reset it to zero and decrement start1 'start1 is the rightmost digit of number1 we need to multiply if start2 < chk_2 then start2 += 1 start1 -= 1 if start1 < chk_1 then start1+=1 end if

loop until outplace = cptr(ulongint ptr,strptr(answer))+1

'put in the carry at the end if carry > 0 then *outplace = carry else *outplace = 0

No idea of what you remember. Did it handle signs and decimal points, or positive integers only? Here are simple converters that change between a simple string of ASCII decimal digits, to a minimum length string that contains close-packed binary bits.

Function plus(Byval num1 As String,Byval num2 As String) As String Static As Const Ubyte AddQMod(0 To 19)={48,49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54,55,56,57} Static As Const Ubyte AddBool(0 To 19)={0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1} Var n_=0 Dim As Ubyte addup=Any,addcarry #macro finish() Return Ltrim(answer,"0") #endmacro If Len(num2)>Len(num1) Then Swap num2,num1 Var diff=Len(num1)-Len(num2) Var answer="0"+num1 For n_=Len(num1)-1 To diff Step -1 addup=num2[n_-diff]+num1[n_]-96 answer[n_+1]=ADDQmod(addup+addcarry) addcarry=ADDbool(addup+addcarry) Next n_ If addcarry=0 Then finish() End If If n_=-1 Then answer[0]=addcarry+48 finish() End If For n_=n_ To 0 Step -1 addup=num1[n_]-48 answer[n_+1]=ADDQmod(addup+addcarry) addcarry=ADDbool(addup+addcarry) If addcarry=0 Then Exit For Next n_ answer[0]=addcarry+48 finish() End Function

Function Base10(BinaryNumber As String) As String Dim As String sum=Left(BinaryNumber,1) For n As Integer=2 To Len(BinaryNumber) sum=plus(plus(sum,sum),Chr(BinaryNumber[n-1])) Next n Return sum End Function