Page images
PDF
EPUB

THE IMPLEMENTATION-DEFINED INITIAL VALUE (SURROUNDED
BY APOSTROPHES) FOR A$=''

THE IMPLEMENTATION-DEFINED INITIAL VALUE FOR Y = 0

IF THE DOCUMENTATION FOR THIS IMPLEMENTATION CORRECTLY
DESCRIBES THE RESULTS ABOVE, THEN

[blocks in formation]

40 PRINT "THIS PROGRAM TESTS THE GROSS SEMANTIC CHARACTERISTICS OF" 50 PRINT "THE PLUS AND MINUS OPERATORS FOR THE CONSTRUCTION OF" 60 PRINT "NUMERIC EXPRESSIONS."

70 PRINT

80 PRINT "EXPRESSIONS USING ONLY ONE OPERATOR AND CONSTANTS AND" 90 PRINT "SIMPLE VARIABLES ARE EVALUATED, AND THE RESULTS TESTED" 100 PRINT "AGAINST THE CORRECT VALUE. CONSTANTS ARE EXPRESSED IN" 110 PRINT "NR1, NR2, AND NR3 FORM, BUT ARE GENERALLY RESTRICTED TO" 120 PRINT "INTEGER VALUES TO AVOID ACCURACY PROBLEMS (ACCURACY IS" 130 PRINT "ADDRESSED IN LATER TESTS)."

140 PRINT

142 REM S IS A SWITCH TO INDICATE UNARY (S=0) OR BINARY (S=1) 143 REM OPERATIONS

145 LET S=0

150 LET M$="24.1: UNARY MINUS"

160 GOSUB 7000

170 LET N$="CONSTANTS"

180 LET 0$="1"

190 LET A=-3

200 IF A>O THEN 250

210 IF A<>-3 THEN 250

220 IF A<-3.1 THEN 250 230 IF A>-2.9 THEN 250 240 IF A=-3 THEN 260

250 GOSUB 9000

260 LET A=-0

270 LET 0$="2"

280 IF A=0 THEN 300

290 GOSUB 9000

300 LET A=-432.0000

310 LET 0$="3"

320 IF -432=A THEN 340

330 GOSUB 9000

340 LET A=-2E2

350 LET 0$="4"

[ocr errors]

360 IF A=-200 THEN 380 370 GOSUB 9000

380 LET A=-200E-1

390 LET 0$="5"

400 IF A=-20 THEN 420

410 GOSUB 9000

420 LET N$="VARIABLES" 430 LET B=34

440 LET 0$="6"

450 LET A=-B

460 IF A=-34 THEN 480

470 GOSUB 9000

480 LET C=-B

490 LET A=-C

500 LET 0$="7"

510 IF A=34 THEN 530

520 GOSUB 9000

530 LET B=-99

540 LET B=-B

550 LET A=-B

560 LET 0$="8"

570 IF A=-99 THEN 590

580 GOSUB 9000

590 GOSUB 8000

600 LET M$="24.2: UNARY PLUS"

610 GOSUB 7000

620 LET N$="CONSTANTS"

630 LET 0$="1"

640 LET A=+5

650 IF A=5 THEN 670

660 GOSUB 9000

670 LET A=+0

680 LET 0$="2"

690 IF A=0 THEN 710

700 GOSUB 9000

710 LET A=+123.00

720 LET 0$="3"

730 IF A=123 THEN 750

740 GOSUB 9000

750 LET A=+87E2

760 LET 0$="4"

770 IF A=8700 THEN 790

780 GOSUB 9000

790 LET A=+.0054E+5

800 LET 0$="5"

810 IF A=540 THEN 830

820 GOSUB 9000

830 LET N$="VARIABLES"

840 LET B=47

850 LET 0$="6"

860 LET A=+B

870 IF A=47 THEN 890

880 GOSUB 9000

890 LET B=-88

900 LET 0$="7"

[blocks in formation]

970 LET M$="24.3: ADDITION"

980 LET N$="CONSTANTS"

990 GOSUB 7000

1000 LET A=3+6

1010 LET O$="1"

1020 LET Y=9

1030 GOSUB 8500

1040 LET A=34.00+32

1050 LET O$="2"

1060 LET Y=66

1070 GOSUB 8500

1080 LET A=23E2+2

1090 LET 0$="3"

1100 LET Y=2302

1110 GOSUB 8500

1120 LET A=33.000+880E-1

1130 LET O$="4"

1140 LET Y=121

1150 GOSUB 8500

1160 LET N$="VAR. & CONSTS."

1170 LET A=-34

1180 LET B=-98.0

1190 LET A=A+B

1200 LET O$="5"

1210 LET Y=-132

1220 GOSUB 8500 1230 LET B=94 1240 LET C=-73 1250 LET A=B+C

1260 LET 0$="6" 1270 LET Y=21

1280 GOSUB 8500 1290 LET C=434 1300 LET B=-654 1310 LET A=B+C

1320 LET O$="7"

1330 LET Y=-220

1340 GOSUB 8500

1350 LET B=-98

1360 LET A=2E2+B 1370 LET 0$="8"

1380 LET Y=102

1390 GOSUB 8500

1400 LET B=13.0E1

1410 LET A=B+22

1420 LET O$="9"

1430 LET Y=152

1440 GOSUB 8500

1450 LET B=22
1460 LET C=-22

1470 LET O$="10"
1480 LET_A=B+C
1490 LET Y=0
1500 GOSUB 8500
1510 LET A=0+C
1520 LET 0$="11"
1530 LET Y=-22
1540 GOSUB 8500
1550 LET A=C+C
1560 LET O$="12"
1570 LET Y=-44

1580 GOSUB 8500

1590 GOSUB 8000

1600 LET M$="24.4: SUBTRACTION"

1610 LET N$="CONSTANTS"

1620 GOSUB 7000

1630 LET 0$="1"

1640 LET A=48-29

1650 LET Y=19

1660 GOSUB 8500

1670 LET A=47-646

1680 LET O$="2"

1690 LET Y=-599

1700 GOSUB 8500

1710 LET A=.00532E5-777.

1720 LET 0$="3"

1730 LET Y=-245

1740 GOSUB 8500

1750 LET N$="VARS. & CONSTS."

1760 LET B=-56

1770 LET C=-93

1780 LET A=B-C

1790 LET O$="4" 1800 LET Y=37

1810 GOSUB 8500 1820 LET A=C-B

1830 LET O$="5"

1840 LET Y=-37

1850 GOSUB 8500

1860 LET B=-345.000

1870 LET A=2-B

1880 LET 0$="6"

1890 LET Y=347

1900 GOSUB 8500

1910 LET A=B-.111E3

1920 LET 0$="7"

1930 LET Y=-456

1940 GOSUB 8500

1950 LET A=B-987 1960 LET 0$="8" 1970 LET Y=-1332

1980 GOSUB 8500

1990 LET A=888.0-B

[blocks in formation]

7080 PRINT "CASE #","SHOULD BE","ACTUAL", "OUTCOME"

[blocks in formation]

9000 REM HANDLE ERROR REPORT

9010 PRINT "ERROR IN TEST OF ";M$;", ";N$;", CASE #";0$

9020 LET R$="FAILED"

9030 RETURN

9040 END

« PreviousContinue »