Page images
PDF
EPUB
[blocks in formation]

260 PRINT "*** TEST FAILED: VALUE SUPPLIED LESS THAN MINIMUM" 270 PRINT "

280 GOTO 320

POSITIVE MACHINE INFINITY. ***11

[blocks in formation]

PROGRAM FILE 31: EXCEPTION ZERO RAISED TO A NEGATIVE POWER.
ANSI STANDARD 7.5

[merged small][merged small][ocr errors][merged small]

1) A MESSAGE IDENTIFYING THE EXCEPTION MUST BE DISPLAYED, AND

2) POSITIVE INFINITY MUST BE SUPPLIED AS THE VALUE OF THE EXPRESSION AND EXECUTION CONTINUES.

BEGIN TEST

% ZERO TO A NEGATIVE POWER IN LINE 220

VALUE SUPPLIED = 1.70141E+38

IF VALUE SUPPLIED = POSITIVE MACHINE INFINITY, AND
EXCEPTION REPORTED, THEN

*** TEST PASSED ***

END PROGRAM 31

END TEST

**

[blocks in formation]

100 PRINT "

110 PRINT "

120 PRINT

130 PRINT "

140 PRINT

150 PRINT "

160 PRINT

1) A MESSAGE IDENTIFYING THE EXCEPTION MUST BE"
DISPLAYED, AND"

2) EXECUTION MUST TERMINATE"

BEGIN TEST"

170 PRINT "ABOUT TO ATTEMPT EVALUATION OF (-2)^ 6.00001:" 200 PRINT

210 LET B=6.00001

220 LET A=-2

230 LET C=A^B

240 PRINT

250 PRINT "VALUE SUPPLIED = ";C

260 PRINT

270 PRINT "*** TEST FAILED: EXECUTION DID NOT TERMINATE. ***" 280 PRINT

[blocks in formation]

1) A MESSAGE IDENTIFYING THE EXCEPTION MUST BE
DISPLAYED, AND

2) EXECUTION MUST TERMINATE

BEGIN TEST

ABOUT TO ATTEMPT EVALUATION OF (-2)^ 6.00001:

% NEGATIVE VALUE RAISED TO NON-INTEGRAL POWER IN LINE 230

[blocks in formation]

40 PRINT "THIS PROGRAM TESTS VARIOUS CASES OF NUMERIC UNDERFLOW." 50 PRINT

60 PRINT "SECTION 33.1: POSITIVE UNDERFLOW"

70 PRINT

80 PRINT "THIS SECTION TESTS THE RESULT OF EXPRESSION EVALUATION"

90 PRINT "LESS THAN POSITIVE MACHINE INFINITESIMAL."

[blocks in formation]

210 REM S IS A SWITCH TO INDICATE FIRST TIME THROUGH LOOP (S=1)

220 REM OR SUBSEQUENT ITERATIONS (S=0). UNDERFLOW SHOULD NOT OCCUR

230 REM FIRST TIME.

240 LET S=1

250 LET M=10

260 LET F=1

270 LET A=.8E-36

280 LET B=1

290 PRINT "ABOUT TO COMPUTE ";A;" / ";M

300 LET A=A/M

310 PRINT "RESULT = ";A

320 PRINT

330 PRINT

340 PRINT

350 IF B<=A THEN 420

360 IF A=0 THEN 420

370 LET B=A

380 LET S=0

390 LET F=F*1.1

400 LET M=10^F

410 GOTO 290

420 REM CONVERGE

430 IF S=0 THEN 470

440 PRINT "*** TEST FAILED: UNDERFLOW OCCURRED ABOVE MAXIMUM" 450 PRINT " MACHINE INFINITESIMAL. ***"

460 GOTO 510

470 IF A=0 THEN 500

480 PRINT "*** TEST FAILED: VALUE SUPPLIED NOT EQUAL ZERO.

[merged small][merged small][merged small][merged small][merged small][ocr errors][merged small][merged small][merged small]

560 PRINT "THIS SECTION TESTS THE RESULT OF EXPRESSION EVALUATION"

570 PRINT "GREATER THAN NEGATIVE MACHINE INFINITESIMAL."

[blocks in formation]

890 PRINT "*** TEST FAILED: UNDERFLOW OCCURRED BELOW MINIMUM"

[blocks in formation]

930 PRINT "*** TEST FAILED: VALUE SUPPLIED NOT EQUAL ZERO. 940 GOTO 960

950 PRINT "*** TEST PASSED *** "1

[blocks in formation]
[blocks in formation]

THIS SECTION TESTS THE RESULT OF EXPRESSION EVALUATION LESS THAN POSITIVE MACHINE INFINITESIMAL.

[blocks in formation]

THIS SECTION TESTS THE RESULT OF EXPRESSION EVALUATION GREATER THAN NEGATIVE MACHINE INFINITESIMAL.

TO PASS THIS TEST:

« PreviousContinue »