Question: period unlimited decimal fraction

p eriode:=proc(r::rational)""  local a,b,c,f,i,k,l,p,q,s:  s:=couvert(evalf(abs(r)-trunc(r),50),string):  if  s[1]="." then s:=s[2..length(s)] fi:  a:=numer(simplify(r)): b:=denom(simplify(r)):  if  igcd(b,10)=1 then       q:=0:       p:=1:      while (10^(p) mod b)<>1 do  p:=p+1 od:  else      f:=ifactors(b)[2]:      k:=0:l:=0:      for i  ;
to nops(f) do
        if f[i][1]=2 then k:=f[i][2] fi:
        if f[i][1]=5 then l:=f[i][2] fi: 
     od:
   c:=b/(2^k*5^l):
   q:=max(k,l):
   if c=1 then p:=0 else p:=op(2,periode(1/c)) fi:
fi:
[q,p,[seq(parse(s[k]),k=1+q..q+p)]]
end:
Error, improper op or subscript selector
Error, reserved word `fi` unexpected
I don't understand these errors. Thank you.

Please Wait...