Attribute VB_Name = "Module2"
Public Sub bigdivide(n1$, n2$, z$)

n$ = n1$
l = Len(n$)
Call isdec(n$, outn, dpl, itn$)
nu1$ = itn$
dpl1 = dpl
kzek = l - dpl

n$ = n2$
l = Len(n$)
Call isdec(n$, outn, dpl, itn$)
nu2$ = itn$
ndpl = dpl + dpl1
kzek1 = l - dpl

Call makeequalplaces(nu1$, nu2$)
If dpl1 > (dpl) Then
ch = (dpl1) + 1
Call buildzero(zb$, ch)
nu1$ = nu1$ & zb$

End If

Debug.Print "divide " + nu1$, nu2$
kz$ = SIDivide$(nu1$, nu2$)
z$ = kz$: gdpl = ndpl
ch = dpl1 + dpl
Call buildzero(zb$, ch)
z$ = z$ + zb$
l = Len(nu1$)
l2 = Len(nu2$)
gdpl = kzek + kzek1
Call incertdeciaml(z$, gdpl, outz$)

z$ = outz$
End Sub
Public Sub getfilefromdisk(finame$, outtextphr$)
Rem read file from disk and stor in outtextphr$
outtextphr$ = ""
phr$ = ""
On Error GoTo nofilefound:
Open finame$ For Input As #1
 Do
 Line Input #1, a$
 phr$ = phr$ + a$
 Loop Until EOF(1)
Close #1
outtextphr$ = phr$

Exit Sub
nofilefound:
Close #1
OUTTOCRTTEXT$ = OUTTOCRTTEXT$ + " error file " + finame$ + " not found."


End Sub

Public Sub putdiskfile(fn$, inphrtext$)

Rem write text to a file according to
Rem name given
Open fn$ For Output As 1
Print #1, inphrtext$
Close #1



End Sub
Public Sub makeequalplaces(nu1$, nu2$)

l = Len(nu1$)
ll = Len(nu2$)

If l > (ll) Then
ch = l - (ll)

Call buildzero(zb$, ch)

End If
nu1$ = nu1$ & zb$


If ll > (l) Then
ch = ll - (l)

Call buildzero(zb$, ch)

End If
nu2$ = nu2$ & zb$



End Sub
Public Sub isdec(n$, outn, dpl, itn$)
itn$ = ""
outn = 0
l = Len(n$)
For k = 1 To (l)
ch$ = Mid$(n$, k, 1)
If ch$ = "." Then outn = 1: dpl = k
If ch$ <> "." Then itn$ = itn$ & ch$
Next k


End Sub
Public Sub bigmultiply(n1$, n2$, z$)
idv = 0
n$ = n1$
Call isdec(n$, outn, dpl, itn$)
outn1 = outn
dpl1 = dpl
n$ = n2$
n1$ = itn$
Call isdec(n$, outn, dpl, itn$)
n2$ = itn$
If outn = 1 Or outn1 = 1 Then idv = 1

If dpl > (dpl1) Then gdpl = dpl Else gdpl = dpl1




If idv = 1 Then
nu1$ = n1$
nu2$ = n2$
If outn = 1 And outn = 1 Then Call makeequalplaces(nu1$, nu2$)
n1$ = nu1$
n2$ = nu2$
Debug.Print n1$
Debug.Print n2$

z$ = SIMultiply$(n1$, n2$)
Call cutzero(z$, nz$)
z$ = nz$
Call incertdeciaml(z$, gdpl, outz$)
z$ = outz$
Else

z$ = SIMultiply$(n1$, n2$)

End If
End Sub
Public Sub cutzero(z$, nz$)
l = Len(z$)


For t = (l) To 1 Step -1
ch$ = Mid$(z$, t, 1)
If ch$ <> Chr$(32) Then
   If ch$ <> "0" Then pl = t
End If
Next t

nz$ = Left$(z$, l - pl)


End Sub
Public Sub incertdeciaml(z$, gdpl, outz$)
outz$ = ""
pl = gdpl
l = Len(z$)
For t = 1 To (l)
ch$ = Mid$(z$, t, 1)

If t = (gdpl) Then outz$ = outz$ & "."
outz$ = outz$ & ch$
Next t


End Sub


Public Sub buildzero(zb$, ch)
zb$ = ""
For kz = 0 To (ch)
t$ = t$ + "0"
Next kz
zb$ = t$
End Sub
