	DIM X,Y,RADIUS,MAXERROR/0/
	DIM THISERROR
	DIM MINERROR,MINEX,MINEY,MAXEX,MAXEY
	DIM XCENTER/255/,YCENTER/127/
	DIM CLEARSCREEN$/:0C/,HOME$/:1B," 0 255"/
	DIM DOTCURSORXY$/:1B,"!"/
	DIM MOVETO$/:1B," "/
	DIM YACC/0/



	WRITE #0,CLEARSCREEN$
10	WRITE #0, HOME$
	INPUT "RADIUS ? " RADIUS
	IF RADIUS<0 OR RADIUS<>INT(RADIUS) OR RADIUS>127 THEN 10
	WRITE #0, CLEARSCREEN$
20	LET X=RADIUS
	LET Y=0
	LET YACC=0
	LET MAXERROR=0
	LET MINERROR=0
	LET MINEX=0 \ MINEY=0 \ MAXEX=0 \ MAXEY=0
100	IF Y>=X THEN 200
	LET THISERROR = SQR(X*X+Y*Y)-RADIUS
	IF THISERROR<MINERROR THEN MINERROR=THISERROR \ MINEX=X \ MINEY=Y
	IF THISERROR>MAXERROR THEN LET MAXERROR=THISERROR \ MAXEX=X \ MAXEY=Y
	WRITE #0, DOTCURSORXY$\PRINT XCENTER+X;YCENTER+Y
	WRITE #0, DOTCURSORXY$\PRINT XCENTER+X;YCENTER-Y
	WRITE #0, DOTCURSORXY$\PRINT XCENTER-Y;YCENTER+X
	WRITE #0, DOTCURSORXY$\PRINT XCENTER-Y;YCENTER-X
	WRITE #0, DOTCURSORXY$\PRINT XCENTER-X;YCENTER-Y
	WRITE #0, DOTCURSORXY$\PRINT XCENTER-X;YCENTER+Y
	WRITE #0, DOTCURSORXY$\PRINT XCENTER+Y;YCENTER-X
	WRITE #0, DOTCURSORXY$\PRINT XCENTER+Y;YCENTER+X
	LET Y=Y+1
	YACC=YACC+Y
	IF YACC>=X THEN LET YACC=YACC-X\X=X-1
	GOTO 100

200	WRITE #0, MOVETO$\PRINT 0;200
	PRINT "MAX ERROR = ";(MAXERROR);" @ ";MAXEX;",";MAXEY
	PRINT "MIN ERROR = ";((MINERROR));" @ ";MINEX;",";MINEY
	GOTO 10

	END
