'Subject: Reciprocal of a small number,
'         print decimal periods of maximal length.
'Author : Sjoerd.J.Schaper
'Date   : 15-01-2004
'Code   : QuickBasic, PDS, VBdos
REM $LANG: "qb"
REM $INCLUDE: 'largeint.bi'
CONST n = 0, d = 1
t = LargeInit(d, "reciproc")
CLS : tim# = TIMER: lin = 7

begin:
LOCATE 1, 1
PRINT "   +------------------+"
PRINT "   |  input small p,  |"
PRINT "   |  0 to exit.      |"
PRINT "   |                  |"
PRINT "   +------------------+"
LOCATE 4, 7: INPUT ; "p"; p$
IF INSTR(p$, "'") THEN GOTO begin
IF VAL(p$) < 1 THEN GOTO eind
LOCATE lin, 1

Letf n, 1: Readst d, p$
Prints "n/d= 1/" + p$, 1

t# = VAL(p$) + 5
IF t# > 32760 THEN t# = 32760
Printr n, d, "dec: ", CINT(t#)
Prints "", 1
lin = CSRLIN: GOTO begin

eind:
LOCATE lin, 1
g$ = STR$(CSNG(TIMER - tim#))
Prints "Timer:" + g$ + " s", 1
CALL Term
SYSTEM

