home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
basic
/
compiler
/
asic
/
sqrt.asi
< prev
next >
Wrap
Text File
|
1994-03-01
|
597b
|
50 lines
REM ** FIXED POINT SQUARE ROOT **
REM ** with ASIC COMPILER **
REM ** @1991, EFD Systems **
start:
print "Enter number ";
input x&
if x&=0 then
end
endif
x&=x&*10000
gosub sqrt:
print "Square root = ";
x=x&
gosub format:
print xs$
goto start:
end
sqrt:
s1&=x&/2
L01:
s2&=x&/s1&
s2&=s2&+s1&
s2&=s2&/2
if s1&>s2& then
s1&=s2&
goto L01:
endif
x&=s2&
return
format:
xi=x/100
xf=x mod 100
xs$=str$(xi)
xs$=ltrim$(xs$)
if xf<10 then
xt$=".0"
else
xt$="."
endif
xs$=xs$+xt$
xt$=str$(xf)
xt$=ltrim$(xt$)
xs$=xs$+xt$
return
end