260 PRINT "*** TEST FAILED: VALUE SUPPLIED LESS THAN MINIMUM" 270 PRINT " 280 GOTO 320 POSITIVE MACHINE INFINITY. ***11 PROGRAM FILE 31: EXCEPTION ZERO RAISED TO A NEGATIVE POWER. 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 *** TEST PASSED *** END PROGRAM 31 END TEST ** 100 PRINT " 110 PRINT " 120 PRINT 130 PRINT " 140 PRINT 150 PRINT " 160 PRINT 1) A MESSAGE IDENTIFYING THE EXCEPTION MUST BE" 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 1) A MESSAGE IDENTIFYING THE EXCEPTION MUST BE 2) EXECUTION MUST TERMINATE BEGIN TEST ABOUT TO ATTEMPT EVALUATION OF (-2)^ 6.00001: % NEGATIVE VALUE RAISED TO NON-INTEGRAL POWER IN LINE 230 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." 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. |