Category : BASIC Source Code
Archive   : ASICIDEA.ZIP
Filename : ROOT.ASI

 
Output of file : ROOT.ASI contained in archive : ASICIDEA.ZIP

REM Demo of ASIC Math handling figuring Square Root
REM Waymon G. Burns
REM 701 Waverly Road
REM Thibodaux, La. 70301
REM Set Compile option to Decimal Math

STARTOFF:
CLS
REM ******** Message ********
PRINT " F I G U R I N G S Q U A R E R O O T S"
PRINT "To figure a square root you make an educated guess of what the root is"
PRINT "SquareRoot=(Guess+(Number/Guess))/2"
PRINT "Example for the number 10 a guess of 3 would be a start"
PRINT "SR = (3+(10/3))/2 = 3.1666667"
PRINT "Figure again with the new number"
PRINT "SR = (3.1666667+(10/3.1666667))/2 = 3.1622807"
PRINT "Figure again"
PRINT "SR = (3.1622807+(10/3.1622807))/2 = 3.1622777"
PRINT "Which equals my pocket calculator"
PRINT "Figuring again brings the root even closer"

REM ******** Get Input then Clear Lines *******
LOCATE 13,10
PRINT "What Number do you want to figure Square Root";
INPUT [email protected]
LOCATE 14,10
PRINT "What Number do you guess is close to Square Root";
INPUT [email protected]
Blank$=SPACE$(65)
LOCATE 13,10
PRINT Blank$
LOCATE 14,10
PRINT Blank$
REM ********* Show your Selections *********
LOCATE 13,10
PRINT "Number ";
N1$=str$([email protected])
N1$=ltrim$(N1$)
print N1$
locate 14,10
print "Guess ";
N2$=str$([email protected])
N2$=ltrim$(N2$)
print N2$
LOCATE 15,10
REM ******* Get first Calculation ********
GOSUB CALCULATE:
LOCATE 16,10

REM ******* Get second Calculation ********
GOSUB CALCULATE:
LOCATE 17,10

REM ******* Get third Calculation ********
GOSUB CALCULATE:
LOCATE 18,10

REM ******* Get fourth Calculation ********
GOSUB CALCULATE:

LOCATE 22,15
PRINT "Check Another Number for Root";
LOOP:
AN$=INKEY$
IF AN$="" THEN LOOP:
IF AN$="Y" THEN STARTOFF:
IF AN$="y" THEN STARTOFF:
END

CALCULATE:
[email protected][email protected]+1
[email protected][email protected]/[email protected]
[email protected][email protected][email protected]
[email protected][email protected]/2
[email protected][email protected]

REM ****** Show formatted Calculations ******
PRINT "(";
N2$=STR$([email protected])
N2$=ltrim$(N2$)
print N2$;
print" + (";
N1$=STR$([email protected])
N1$=LTRIM$(N1$)
print N1$;
print "/";
print N2$;
print "))/2 = ";
X3$=STR$([email protected])
X3$=LTRIM$(X3$)
print x3$
[email protected][email protected]
RETURN