NBPrg40. (*inc). (**CalcWS). csqrt.inc. MiniOS. OpenSource.

NBPrg40. (*inc). (**CalcWS). csqrt.inc. MiniOS. OpenSource.
**************************************

Procedure calc_register.csqrt(s:String);
Label derr,norm,ex;
Var i,l,j:byte;
    ch,ch1:char; s1:String;
    r:real; o:integer;
Begin
  i:=pos('sqrt',s); delete(s,i,5); ch:=s[1];
  l:=length(s); s1:='';
  For i:=1 To l Do
      If ((48<=ord(s[i])) And (ord(s[i])<=57))
          Or (s[i]='+') Or(s[i]='.')
          Or (s[i]='-') Or (s[i]='E') Then s1:=s1+s[i];
  ch1:=s[3];
  If s1<>'' Then Begin
     val(s1,r,o);
     If r<0 Then Goto derr;
     If (ch='a') Or (ch='A') Then a:=sqrt(r);
     If (ch='b') Or (ch='B') Then b:=sqrt(r);
     If (ch='c') Or (ch='C') Then c:=sqrt(r);
     If (ch='d') Or (ch='D') Then d:=sqrt(r);
     If (ch='e') Or (ch='E') Then e:=sqrt(r);
     If (ch='f') Or (ch='F') Then f:=sqrt(r);
     If (ch='g') Or (ch='G') Then g:=sqrt(r);
  End Else Begin
     If (ch1='a') Or (ch1='A') Then r:=a;
     If (ch1='b') Or (ch1='B') Then r:=b;
     If (ch1='c') Or (ch1='C') Then r:=c;
     If (ch1='d') Or (ch1='D') Then r:=d;
     If (ch1='e') Or (ch1='E') Then r:=e;
     If (ch1='f') Or (ch1='F') Then r:=f;
     If (ch1='g') Or (ch1='G') Then r:=g;
     If r<0 Then Goto derr;
     If (ch='a') Or (ch='A') Then a:=sqrt(r);
     If (ch='b') Or (ch='B') Then b:=sqrt(r);
     If (ch='c') Or (ch='C') Then c:=sqrt(r);
     If (ch='d') Or (ch='D') Then d:=sqrt(r);
     If (ch='e') Or (ch='E') Then e:=sqrt(r);
     If (ch='f') Or (ch='F') Then f:=sqrt(r);
     If (ch='g') Or (ch='G') Then g:=sqrt(r);
  End;

  norm:
  settextstyle(smallfont,horizdir,5);
  With pinterf^ Do Begin
       s_[1]:='';
       outhelp;
  End; Goto ex;

  derr:
  settextstyle(smallfont,horizdir,5);
  With pinterf^ Do Begin
       s_[1]:='sqrt, r<0 !!!';
       outhelp;
  End;


  ex:
End;