NBSIR 78-1420-4 ^

NBS Minimal BASIC Test

Programs - Version 1

User's Manual

Volume 4 - Mathematical and User Defined Functions, Compound

Expressions

David E. Gilsinn

Charles L. Sheppard

Systems and Software Division

Institute for Computer Sciences and Technology

National Bureau of Standards

Washington, D C. 20234

U.S. DEPARTMENT OF COMMERCE

NATIONAL BUREAU OF STANDARDS

NBSIR 78-1420-4

NBS MINIMAL BASIC TEST

PROGRAMS - VERSION 1

USER'S MANUAL

Volume 4 - Mathematical and User Defined Functions, Compound

Expressions

David E. Gilsinn

Charles L Sheppard

Systems and Software Division

Institute for Computer Sciences and Technology

National Bureau of Standards

Washington, D C. 20234

U.S. DEPARTMENT OF COMMERCE, Juanita M. Kreps, Secretary

Dr. Sidney Harman, Under Secretary

Jordan J. Baruch, Assistant Secretary for Science and Technology

NATIONAL BUREAU OF STANDARDS, Ernest Ambler, Acting Director
ABSTRACT

This volume is the fourth of four volumes that comprise the user's guide

to the NBS Minimal BASIC test programs. Tney test whether a BASIC processor

accepts the syntactical forms and produces semantically meaningful results

accoroing to the specifications given in BSR X3.6u Proposed Amer i can National

Standard for Minimal BASIC- The programs in this volume include:

mathemat i cal function tests; exception tests for some of the functions; a statistical test of tne uniformness of the random number generator; user oefined function tests; syntax tests on tne functions; tests using compound

arithmetic expressions and certain semantic tests on arrays and variaole

initialization- The entire set of test programs is available on magnetic

tape

Key Nords: BASIC, BASIC standard, BASIC validation, compiler valioation,

computer programming language, computer standards
Table of Contents

Page

k) . fc) Introduction 1

94. k) The SQR Function 3 Program Listing 1+ Sample Output 6 95.0 Exception Test for the SoR Function 7 Program Listing 7 Sample Output 8 96.0 The ATN Function 9

Program Listing 9 Sample Output

97.0 The COS Function 13

Program Listing 13

Sample Output 15

98.0 The EXP Function 17

Program Listing 17

Sample Output 19

99.0 Exception Test for the EXP Function 21

Program Listing 21

Sample Output 22

100.0 Underflow of the Exponential Function 2h

Program Listing 2h

Sample Output 2k

101.0 The LOG Function 26

Program Listing 26

Sample Output 29

102.0 Exception Test for the LOG Function with Zero

Argument 30

Program Listing 30

Sample Output 30

103.0 Exception Test for the LOG Function with a Negative Argument 32

Program Listing 32

Sample Output 32

104.0 The SIN Function 3

I+ Program Listing 3U

Sample Output 36

105.0 The TAN Function 38

Program Listing 38

Sample Output i*0

106.0 Accuracy for Exponentiation 42

Program Listing 42

Sample Output 44

i i i
107. fe) Exception Test for TAN Function at PI/2 46

Program Listing 46

Sample Output 47

108.0 RND Function without RANDOMIZE 4g

Program Listing 4g

Sample Output 49

109.0 RND Function witn RANDOMIZE 52

Program Listing 52

Sample Output 53

110.0 Uniformity Test for the RND Function 55

Program Listing 56

Sample Output 59

111.0 User Defined Functions witn a Parameter List

Program Listing 52

Sample Output 55

112.0 Testing All Possible Parametrized User Defined

Function Specifications 6 ? Program Listing 67

Sample Output 59

113.0 User Defined Functions witnout a Parameter List 70

Program Listing 73^ Sample Output 72

114.0 User Defined Function Diagnostic - The Same

Function is Defined More Than Once ^,71^, Program Listing ' 71* Sample Output 75

115.0 A User Defined Function is Referenced Inside Its

Own Definition 76

Program Listing 76

Sample Output 76

116.0 Syntax Diagnostic - Argument List Used

Incorrectly witn a Defined Function 78

Program Listing 78

Sample Output 78

117.0 Syntax Diagnostic - No Argument List for the ABS

Function 79

Program Listing 79

Sample Output 79

118.0 Syntax Diagnostic - No Argument List with ATN 80

Program Listing 80

Sample Output 80

119.0 Syntax Diagnostic - No Argument List with COS 8 l Program Listing 8 l Sample Output 8 l

IV
120. fc) Syntax Diagnostic - No Argument List with EXP 82

Program Listing 82

Sample Output 82

121.0 Syntax Diagnostic - No Argument List with INT 83

Program Listing 83

Sample Output 83

122.0 Syntax Diagnostic - No Argument List with LOG Sk

Program Listing 84

Sample Output 84

123.0 Syntax Diagnostic - No Argument List with SGN 85

Program Listing 85

Sample Output 85

124.0 Syntax Diagnostic - No Argument List with SIN 86

Program Listing 86

Sample Output 86

125.0 Syntax Diagnostic - No Argument List with SoR 8?

Program Listing 8 t Sample Output 8 t 126.0 Syntax Diagnostic - No Argument List with TAN 88

Program Listing 88

Sample Output 88

127.0 Syntax Diagnostic - A Defined Function with an Argument but Called without It 89

Program Listing 89

Sample Output 89

128.0 Syntax Diagnostic - ABS Used with too Many

Arguments 90

Program Listing 90

Sample Output 90

129.0 Syntax Diagnostic - ATN with too Many Arguments 92

Program Listing 92

Sample Output 92

130.0 Syntax Diagnostic - COS with too Many Arguments 93

Program Listing 93

Sample Output 93

131.0 Syntax Diagnostic - EXP with too Many Arguments 94

Program Listing 94

Sample Output 94

132.0 Syntax Diagnostic - INT with too Many Arguments 95

Program Listing 95

Sample Output 95

133.0 Syntax Diagnostic - LOG with too Many Arguments 96

Program Listing 96

Sample Output 96

V
134. Syntax Diagnostic - SGN witn too Many Arguments 9T

Program Listing 97

Sample Output 97

135.0 Syntax Diagnostic - SIN with too Many Arguments 98

Program Listing 98

Sample Output 98

136.0 Syntax Diagnostic - SQR with too Many Argumen ts 99

Program Listing 99

Sample Output... 99

137.0 Syntax Diagnostic - TAN with too Many Arguments 100

Program Listing 100

Sample Output lOO

138.0 Syntax Diagnostic - Defined Function with more

than One Argument lOl

Program Listing 101

Sample Output 101

139.0 Syntax Diagnostic - A Defined Function with

Illegal Argument 103

Program Listing 103

Sample Output 103

140.0 Syntax Diagnostic - Reference to an Undefined

Function lOl* Program Listing lOl* Sample Output lOU

141.0 Testing the STOP Statement 106

Program Listing 106

Sample Output 107

142.0 END Statement must be the Last Program Statement 108

Program Listing 108

Sample Output 108

143.0 A Program Requires an END Statement 110

Program Listing 110

Sample Output 110

144.0 Compound Expressions as Arguments for A3S and ATN . . . . Ill

Program Listing Ill

Sample Output 113

145.0 Compound Expressions as Arguments for COS and EXP.... 115

Program Listing 115

Sample Output 117

146.0 Compound Expressions as Arguments for LOG and SGN.... 119

Program Listing 119

Sample Output 121

14"^. 0 Compound Expressions as Arguments for SIN and S(JR. . . . 122

Program Listing 122

VI
Sample Output- 12 k

148. k) Compound Expressions as Arguments for TAN and INT.... 125

Program Listing 12 5 Sample Output 127

149.8 Compound Expressions as Arguments for a User- Defined Function 128

Program Listing 128

Sample Output 129

158.8 Compound Expressions Used as PRINT Items and

TAB Arguments 130

Program Listing 130

Sample Output 132

151.8 Compound Expressions Used in IF-THEN Statements 13U

Program Listing 13 It Sample Output 135

152.8 Compound Expressions Used in FOR-NEXT Statements 136

Program Listing 136

Sample Output 137

153.0 Compound Expressions Used in Subscripts 138

Program Listing 138

Sample Output 139

154.8 A Compound Expression Used in an ON-GOTO

Statement l40

Program Listing lEo

Sample Output lUi

155.8 Compound Expressions Using Supplied Functions l42

Program Listing l42

Sample Output l43

156.0 Semantic Error--Upper Bound of Array Set to Zero

witn OPTION 144

Program Listing l44

Sample Output l44

157.0 Semantic Er r or--Mul ti pie OPTION Statements l45

Program Listing l4 5 Sample Output l45

158.0 Semantic Error —OPTION Statement after Array

Reference l46

Program Listing l46

Sample Output l46

159.0 Semantic Error —Array Declaration Out of Place l48

Program Listing l48

Sample Output l48

168.0 Semantic Er ror--Dimensioni ng an Array More than Once. i49

Program Listing l49

V i i
Sample Output II49

161 . k) Initializing String Variables 150

Program Listing 150

Sample Output 151

vi i i
0.0 INTRODUCTION

This is the final volume of a foui volume set. The progiams documented

in these volumes form the NBS test system. They are intended for use as validation tools to test the conformance of a BASIC computer language

processor to the American National Standard for Minimal BASIC X3.60. The

individual routines in this volume include: mathematical function tests;

exception tests for some of the functions; statistical tests for the rando.m

number generator; user-oefined function tests; syntax tests on tne

functions; and tests using compound expressions as (1) arguments for

functions, (2) parameters in control statements, and (3) print items. The

final programs include semantic error diagnostic tests. In

order to understand the context of this volume the reader should be familiar

with the first three volumes to this set and the American National Standaro

for Minimal BASIC, BSR X3.fe0.

Each section contains short statements of the objectives of the test

program associated with the section. Many of the sections have subsections

that correspond to subtests within the main test program for that section.

After each set of descriptive paragraphs, a listing of the program is given,

and finally a sample output is reproduced.

Sections 94 through 107 introduce the trigonometric and other

mathematical functions by sampling the accuracy maintained by each.

The Minimal BASIC standard does not specify the accuracy requirements for the

implementation supplied mathematical functions. However, a user needs some assurance of accuracy in order to have faith in his calculations. Therefore,

a method to detect and flag any "computed deviations" from a function's "true

results", to within less than one unit in the sixth significant digit of the

function's evaluations of test arguments, is included. Each function test

routine contains a sample of arguments and true evaluations rounded to six

significant digits. The sample arguments essentially cover the range of

permitted numbers of absolute value from lE-38 to lE+38. There is a detailed

discussion of the numerical comparison procedures used for each of the

functions given in section 94.0. The same procedure is used with each of the

other mathematical functions.

A pseudo-random number generator is accessible to BASIC programs.

Sections 108 to 110 introduce the implementation-supplied random numbergenerator RND. A call to RND generates the next pseudo-random number in an implementation-supplied sequence of numbers, uniformly distributed in the

interval 0<= RND < 1. When the statement RANDOMIZE is used in a program the

sequence is different for each execution of the program. A statistical test

program is included in section 110.0. It assesses the uniformity of the

sequence of pseudo-random numbers. The test used is a goodness-of-f it test.

In particular the test performs thirty chi-square tests, and then performs a goodness-of-fit test of the resultant chi-square values to the cumula t i ve chi-square distribution. These two steps give information both on the local

and the global behavior of the pseudo-random number sequence.

Tests for user-definea functions are given in sections 111 to 116.

These functions can be defined by users with and without parameters. Several

programs test defined functions. Some of the program outputs call for

diagnostics because the def ined-functions used are semantically

non-meani ngful

.

1
The second naif of this volume includes: syntax tests for; tne

mathematical functions and a set of tests that emphasize various uses of

mathematical functions and arrays. In these tests compound expressions are also substituted for the parameter at call time. Compound expressions are also useo as expressions in many of the control statements.

It should be reiterated that the tests are concerned not only with the

language conformance to the ANSI 6SR X3.60 specifications, but also with the

implementation conformance of the language since tne user ultimately

confronts the implementation. In general the user expects the language to be

a useful tool to solve a problem. In order to solve problems, however, the

implementation of tne language must perform operations that are meaningful to

the user. This is why a great deal of attention has been paid to

implementation questions in this set of tests.

2
94.0 THE SQR FUNCTION

The objective of this test is to introduce the use of the SQR function

by performing a short evaluation of the accuracy maintained by the

implementation-supplied function for the host system (see section 8 of BSR

X3.60. These tests are not intended to be exhaustive, but are intended

to show a broad view of what range of numbers the user can expect adequate

function performance. For a discussion of more thorough evaluation

techniques the reader is referred to C. T. Fike, Computer Evaluation of

Mathematical Functions , Prentice-Hall, Inc., Englewood Cliffs, N.J. (196^

or J. F. Hart, et. al.. Computer Approximations , John Wiley and Sons,

Inc., New York (1968).

The test first compares the evaluation of the SQR function on a set of

arguments with a known set of results, and then computes the relative error

of the system-generated result with respect to the known result. The

known-values were computed by an extended precision routine and rounded to

six significant digits. All of this data is displayed in four columns. The

first column is labeled ARGUMENT, the second column is labeled TEST

VALUE, the third column is labeled SYSTEM VALUE, and the fourth column is

labeled RELATIVE ERROR. At the end, the error range is displayed.

The "relative error" concept is used because it allows one to detect a deviation of one digit in the last significant place, which in this case is

the sixth significant digit. This is done, in fact, without the need to know

an implementation-defined machine "infinitesimal". The argument is as follows: First suppose that a floating point number y is represented in the

normalized form y

= mEa where Ea, of course, represents ten to the power a and we suppose that 1/10 <= ABS (m) < 1. Let z = nEa be an approximation to

y. Then y and z agree within six significant digits, assuming rounding

arithmetic, provided that ABS(m-n) <= 0.5E-6. The relative error between y

and z, assuming y is not zero, can be written as ABS((z-y)/y) = ABS((n-m)/m)

<= (0. 5E-6)/ABS (m) . But ABS(y) = ABS (m) * lEa so that 1/ABS (m) = lEa/ABS(y).

Therefore we have for the case y <> 0 that ABS((z-y)/y) <= (0.5E-6) * (P/Yl)

where we have set P = lEa and Y1 = ABS(y). This gives us a formula to detect

any deviation including the last significant digit, provided we determine P. This is fairly simple. Instead of storing this value for each y used we can compute P by selecting that power 10 such that 10^(a-l) <= y < 10"a. Then

let P = 10^'a = lEa. We note that in order not to overflow, scaling factors

Si and S2 have been used in the function test codes, in order to maintain

numbers within manageable size. Finally, in order to handle the case y

= 0 we have to distinguish two possibilities; The case z = 0 and z <> 0. If z =

0 then there is no error and we define the relative error to be 0. If z <> 0 then we exchange the roles of y and z. The user need only look for asterisk (*) flags to the right of the

relative error column. If there are none, even though positive relative

errors show, the test has "passed". This is an informative test, and is

intended to perform two tasks. First, it is intended as a program to

demonstrate the pure language capability of the implementation, with respect

to accessing a supplied function. However, a user might be somewhat upset if

SQR(25) <> 5. Therefore, secondly, the test seeks to sample, albeit not

exhaustively, the accuracy of the supplied function. ANSI Minimal BASIC does

not specify the accuracy of the supplied function, but it does recommend that

arithmetic operations attempt to maintain six significant places. Therefore

this test demands accuracy within six significant digits. The user should

3
pay attention, on some systems, to

the functions that occur at large arg

becomes unbounded; and points at

designers there are references that c quality function subroutines. The fu

al., Computer Approximations , John Wi

any deter i or a uments; poin

which the

an be consult

ndamental ref

ley & Sons, I

t i (on i n accuracy of some of

ts a t which the f unct i on

f u nc t io n i s ne ar ze ro

.

For

ed i n o rder to deve lop h igh

erien c e is John F. Hart, et nc • 1 Ne w York (1968 ) .

icific'k'kiciiifififit'kic'k'kif-kit'k * PROGRAM FILE 94 *

•kicic’kitlfiticitifificic'ic-k'kiflt-k

0010 PRINT "PROGRAM FILE 94"

0020 PRINT

0030 PRINT

0040 PRINT

0080 PRINT

0090 PRINT II SECTION 94 .0"

0100 PRINT

0110 PRINT II SQUARE ROOT FUNCTION (SOR) " 0120 PRINT

0130 PRINT '* BEGIN TEST"

0140 PRINT

0150 DATA . 00000 , . 000000 , .10000E-34 f • 316228E-17

0160 DATA .10000E-15 ,

. 100000E-07 , .10000E-07 9 * 100000E-03

01’70 DATA .10000E-03 ,

. 100000E-01 , .10000E-01 9 • 100000E+00

0180 DATA .98491E-01 ,

. 313833E+00 , .20000E+00 9 • 447214E+00

0190 DATA .26795E+00 ,

. 517639E+00 , .50000E+00 9 • 707107E+00

0200 DATA .10000E+01 , . 100000E+01 , .30000E+01 9 * 173205E+01

0210 DATA .50000E+01 ,

. 223607E+0J , .11000E+02 9

• 331662E+01

0220 DATA .25000E+02 , . 500000E+01 , .75000E+02 9 • 866025E+01

0230 DATA .10000E+11 ,

. 100000E+06 , .10000E+36 9 • 316228E+18

0240 DIM E ( 20)

0250 LET L = 0 0260 LET H = 0 0270 LET M = 0 0280 LET V = 0 0290 PRINT II n /It II II M II II RELATIVE " 0300 PRINT " ARGUMENT" , " TEST VALUE", " SYSTEM VALUE "

, " ERROR

0 310 FOR I = 1 TO 18

0315 LET SI = 1 0320 READ X , Y 0330 LET A$ __ II II 0340 LET Z = SQR(X)

03'70 IF ABS(Y) >= lE-38 THEN 377

0371 IF ABS (Z) >= lE-38 THEN 374

0372 LET E ( I ) = 0.0

0373 GO TO 420

0374 LET T1 = Y 0375 LET Y = Z

I

i
0376 LET Z = T1

0377 REM TEST Y FOR SCALING

0378 IF ABS(Y) <= 1E30 THEN 380

0379 LET SI = lE-8

0380 IF ABS(Y) >= lE-30 THEN 382

0381 LET SI = 1E8

0382 LET E(I) = ((S1*Z) - (S 1 *Y ) ) / (Si *Y ) 0383 LET E (I ) = ABS (E (I )

)

0384 LET Al = E (I

)

0385 LET Y2 = Y

0386 GOSUB 9000

0387 IF ABS(Al) < C THEN 420

0410 LET A$ = •'****" 0420 PRINT X,Y,Z,E(I) ;A$

0430 NEXT I 0440 PRINT

0450 PRINT " EVALUATION OF THE ABSOLUTE RELATIVE

0460 PRINT "ERRORS"

0470 PRINT

0480 FOR I = 1 TO 18

0490 IF H > E (I) THEN 520

0500 LET H = E (I

)

0510 GO TO 540

0520 IF L <= E(I) THEN 540

0530 LET L = E (I)

0540 NEXT I 0700 PRINT

0710 PRINT " LOWEST ERROR =";L;" HIGHEST ERROR =";H

0720 PRINT

0810 PRINT " END TEST"

0820 PRINT

0850 GO TO 9400

9000 IF 1 <= ABS(Y2) THEN 9101

9001 LET S2 = 1 9003 IF ABS(Y2) > lE-37 THEN 9010

9005 LET P = lE-37

9007 LET S2 = 1E10

9009 GO TO 9200

9010 LET P = 1 9020 LET PI = P/10

9030 IF PI <= ABS(Y2) THEN 9200

9040 LET P = P/10

9050 GO TO 9020

9101 LET S2 = 1 9105 IF ABS(Y2) <= 1E37 THEN 9110

9106 LET P = 1E38

9107 LET S2 = lE-10

9109 GO TO 9200

9110 LET P = 10

9120 IF ABS(Y2) < P THEN 9200

9130 LET P = P*10

9140 GO TO 9120

9200 LET Y1 = ABS (Y2)

9210 LET C = (.5E-6)*( (P*S2)/(Y1*S2) ) 9300 RETURN

9400 END

5
kic^'k-k-kiiic'kifititicicic-kif * SAMPLE OUTPUT *

-kicif-kic-kicisicit'kiK-kicit-kie

PROGRAM FILE 94

SECTION 94.0

SQUARE ROOT FUNCTION (SQR)

BEGIN TEST

RELATIVE

ARGUMENT TEST VALUE SYSTEM VALUE ERROR

0 0 0 0 1. 00000E-35 3. 16228E-18 3. 16228E-18 0 1. 00000E-16 1. 00000E-8 1. 00000E-8 0 1. 00000E-8 . 0001 . 0001 0

. 0001 . 01 . 01 0 .01 . 1 . 1 0

. 098491 . 313833 . 313833 0

. 2 . 447214 . 44"'214 0

. 26795 . 51^639 . 517639 0

. 5 . 70710T . 70-7107 0

1 1 1 0

3 1.73205 1.73205 0

5 2.2360"' 2.23607 0 11 3.31662 3.31662 0 25 5 5 0 75 8.66025 8.66025 0 1. 00000E+10 100000 100000 0 1. 00000E+35 3. 16228E+17 3. 16228E+17 0 EVALUATION OF THE ABSOLUTE RELATIVE ERRORS

LOWEST ERROR 0 HIGHEST ERROR 0 END TEST

6
95 k) EXCEPTION TEST FOR THE SQR FUNCTION

The objective of

recognizes the use of

an exception (see secti

exception, it should

implementations return

program. If the latt

Standard does not pr

exception. This test

a negative value, as fo

should contain some fo error.

this test is to verify that

a negative numerical argument fo on 8.5 of BSR X3.60). Upon

be reported and the program execu

the square root of the absolute v er occurs, the test fails since t escribe any specified procedur

allows the argument of the SQR fu

und in lines 240 and 250 in progr

rm of implementation-defined diag

the implementation

r the SQR function as recognition of the

tion suspended. Some

alue and continue the

he ANSI Minimal BASIC

es to handle this

notion to be assigned

am file 95. Output

nostic concerning the

ic-k-k'k-kicicitic-k-k-kic’kil'kic'k-k * PROGRAM FILE 95 *

ic'k'k'kiticic-kicit-kicic’kie'kicicic

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 LET X

0250 LET Y

0260 PRINT

02"70 PRINT

0280 PRINT

0290 PRINT

0300 PRINT

0310 PRINT

0320 END

"PROGRAM FILE 95"

SECTION 95.0; EXCEPTION TEST FOR THE SQR FUNCTION."

" THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

"THIS SYSTEM RECOGNIZES AN ARGUMENT OF THE SQR FUNCTION WITH

"A NEGATIVE VALUE AS AN EXCEPTION. IT SHOULD BE REPORTED"

"IF SUCH A RECOGNITION SHOULD OCCUR, CONSIDER SYSTEM TO HAVE

"PASSED TEST.

BEGIN TEST."

-64

SQR (X)

"IF A NUMERICAL VALUE IS PRINTED BELOW WITHOUT A DIAGNOSTIC"

"THE SYSTEM FAILED THE TEST."

Y END TEST."

M

II

7
'kit-kiticicic-k-kicicic'k'kif-kic * SAMPLE OUTPUT *

ic-kitititicicicicicic-kicic-k-kic

PROGRAM FILE 95

SECTION 95.0: EXCEPTION TEST FOR THE SQR FUNCTION.

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

THIS SYSTEM RECOGNIZES AN ARGUMENT OF THE SQR FUNCTION WITH

A NEGATIVE VALUE AS AN EXCEPTION. IT SHOULD BE REPORTED

IF SUCH A RECOGNITION SHOULD OCCUR, CONSIDER SYSTEM TO HAVE

PASSED TEST.

. BEGIN TEST.

?SQRT OF NEGATIVE NUMBER IN LINE 250

8
96.0 THE ATN FUNCTION

The objective of this test is to introduce the use of the ATN function,

by sampling the accuracy maintained by the implementation-supplied function

(see section 8 of BSR X3.60). The ATN function returns the angle in radians

whose TAN is the argument of ATN. The range of the ATN function varies from

-(pi/2) to (pi/2). The actual test, except for using the ATN function

instead of the SQR function, is the same in structure and output as that of

section 94.0.

ifit-k-k'k'k'k'k’kicicicitlf-k-kic'kic * PROGRAM FILE 96 *

-kitisiclt'k'kicitiflticicic-kic'kitit

0010 PRINT "PROGRAM FILE 96"

0020 PRINT

0030 PRINT

0040 PRINT

0080 PRINT

0090 PRINT II SECTION 96. 0"

0100 PRINT

0110 PRINT II ARCTANGENT FUNCTION (ATN)

0120 PRINT

0130 PRINT II BEGIN TEST"

0140 DATA - . 10000E+26 9 -. 157080E+01 9 -. 10000E+03 9

. 156080E+01

0150 DATA - . 85000E+02 9 -. 155903E+01 9 -. 50000E+02 9 “ . 155080E+01

0160 DATA - . 16000E+02 9 -. 150838E+01 9 -. 80000E+01 9 ” . 144644E+01

0170 DATA - . 40000E+01 9 -. 132582E+01 9 -. 20000E+01 9 . 110715E+01

0180 DATA - . 80000 9 -. 674741 9 -. 41421 9 ~ . 392696

0190 DATA - . 30000 9 -. 291457 9 -.19891 9 .196347

0200 DATA - . 10000 9 -. 996687E-01 9 -. 10000E-02 9 “ . 100000E-02

0210 DATA - . 10000E-04 9 -. 100000E-04 9 -. 10000E-10 9 . 100000E-10

0220 DATA - . 10000E-24 9 -. 100000E-24 9

. 00000 9 . 000000

0230 DATA . 10000E-34 9

. 100000E-34 9 . 10000E-15 9 . 100000E-15

0240 DATA . 10000E-07 9 . 100000E-0'7 9. 10000E-03 9

. 100000E-03

0250 DATA . 10000E-01 9

. 999967E-02 9 . 98491E-01 9

. 981744E-01

0260 DATA .20000 9 . 197396 9 . 26’’95 9 . 261800

0270 DATA . 50000 9 .463648 9 . 10000E+01 9

. 785398

0280 DATA . 30000E+01 9 . 124905E+01 9 . 50000E+01 9 . 137340E+01

0290 DATA . 11000E+02 . 148014E+01 9 . 25000E+02 9 . 153082E+01

0300 DATA . 75000E+02 9 . 155746E+01 9 . 10000E+11 9 . 157080E+01

0310 DATA . 10000E+36 9

. 157080E+01

0320 DIM E ( 35)

0330 LET L = 0 0340 LET H = 0 0350 LET M = 0 0360 LET V = 0 03''0 PRINT II It II II II / t "

, "RELATIVE"

9
0380 PRINT " ARGUMENT"/' TEST VALUE" /’ SYSTEM VALUE"/' ERROR"

0390 FOR I = 1 TO 35

0395 LET SI = 1 0400 READ X,Y

0410 LET A$ = " " 0420 LET Z = ATN (X)

0425 IF ABS(Y) >= lE-38 THEN 432

0426 IF ABS(Z) >= lE-38 THEN 429

0427 LET E (I ) = 0.

0

0428 GO TO 500

0429 LET T1 = Y

0430 LET Y = Z 0431 LET Z = Tl

0432 REM TEST Y FOR SCALING

0433 IF ABS(Y) <= 1E30 THEN 435

0434 LET SI = lE-8

0435 IF ABS(Y) >= lE-30 THEN 43"’ 0436 LET SI = 1E8

0437 LET E(I) = ((S1*Z) - {S 1 *Y ) ) / (S 1 *Y ) 0438 LET E (I ) = ABS (E (I ) ) 0439 LET A1 = E (I)

0440 LET Y2 = Y 0441 GOSUB 9000

0442 IF ABS(Al) < C THEN 500

0490 LET A$ = "****" 0500 PRINT X, Y, Z , E (I ) ;A$

0510 NEXT I 0520 PRINT

0530 PRINT " EVALUATION OF THE ABSOLUTE RELATIVE";

0540 PRINT " ERRORS"

0550 PRINT

0560 PRINT

05"70 FOR I = 1 TO 35

0580 IF H > E(I) THEN 610

0590 LET H = E (I

)

0600 GO TO 630

0610 IF L <= E(I) THEN 630

0620 LET L = E (I

)

0630 NEXT I 0740 PRINT

0750 PRINT " LOWEST ERROR =";L;" HIGHEST ERROR =";H

0760 PRINT

0850 PRINT " END TEST"

0860 PRINT

0870 GO TO 9400

9000 IF 1 <= ABS(Y2) THEN 9101

9001 LET S2 = 1 9003 IF ABS(Y2) > lE-37 THEN 9010

9005 LET P = lE-37

9007 LET S2 = 1E10

9009 GO TO 9200

9010 LET P = 1 9020 LET PI = P/10

9030 IF PI <= ABS(Y2) THEN 9200

9040 LET P = P/10

9050 GO TO 9020

9101 LET S2 = 1

10
9105 IF ABS(Y2) < = 1E37 THEN 9110

9106 LET P = 1E38

9107 LET S2 = lE- 10

9109 GO TO 9200

9110 LET P = 10

9120 IF ABS(Y2) < P THEN 9200

9130 LET P = P*10

9140 GO TO 9120

9200 LET Y1 = ABS (Y2)

9210 LET C = (.5E -6)*( (P *S2)/(Y1*

9300 RETURN

9400 END

icitic-kicicitisicit-k-kititiciclr * SAMPLE OUTPUT *

iticitit'kilifit'k'k'k’k'k-kicitic

PROGRAM FILE 96

SECTION 96.0

ARCTANGENT FUNCTION (ATN)

BEGIN TEST

RELATIVE

ARGUMENT TEST VALUE SYSTEM VALUE ERROR

-1. 00000E+25 -1.5708 -1.5708 0 -100 -1.5608 -1.5608 0 -85 -1.55903 -1.55903 0 -50 -1.5508 -1.5508 0 -16 -1.50838 -1.50838 0 -8 -1.44644 -1.44644 0 -4 -1.32582 -1.32582 0 -2 -1.10715 -1.10715 0 -.8 -.674741 -. 674741 0 -.41421 -. 392696 -. 392696 0 -.3 -. 291457 -.291457 0 -.19891 -. 196347 -.196347 0 -.1 -9. 96687E-2 -9.96687E-2 0 -.001 -. 001 -.001 0 -.00001 -. 00001 -. 00001 0 -1. 00000E-11 -1. 00000E-11 -1. 00000E-11 0 -1. 00000E-25 -1 . 00000E-25 -1. 00000E-25 0

0 0 0 0 1. 00000E-35 1. 00000E-35 1. 00000E-35 0 1. 00000E-16 1. 00000E-16 1. 00000E-16 0

11
1. 00000E-8 1. 00000E-8 1. 00000E-8 0

. 0001 . 0001 . 0001 0 .01 9. 99967E-3 9. 99967E-3 0

. 098491 9. 81744E-2 9. 81'744E-2 0

. 2 . 197396 . 197396 0

. 26795 . 2618 . 2618 0

. 5 . 463648 . 463648 0

1 . '85398 .785398 0

3 1. 24905 1. 24905 0 5 1. 3734 1. 3''34 0 11 1.48014 1.48014 0 25 1.53082 1. 53082 0

•75 1.55746 1.55746 0

1 . 00000E+10 1.5708 1.5708 0 1. 00000E+35 1.5708 1. 5'708 0 EVALUATION OF THE ABSOLUTE RELATIVE ERRORS

LOWEST ERROR HIGHEST ERROR = 0 END TEST

12
97.0 THE COS FUNCTION

The objective of this test is to introduce the use of the COS function

by sampling the accuracy maintained by the implementation-supplied function

(see section 8 of BSR X3.60). The COS function returns the cosine of an argument entered as an argument in radians. This test, except for the use of

the COS function instead of the SQR function, is the same as section 94..

icic'kicic'k-k-k'k-k'kicicie-k-kicif’k * PROGRAM FILE 97 *

'k'k'k'kicicir-k'kic’kicicis'k'k-kii'k

0010 PRINT "PROGRAM FILE 97"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT II SECTION 97.0 II 0100 PRINT

0110 PRINT II COSINE FUNCTION (COS)

0120 PRINT

0130 PRINT II BEGIN TEST"

0140 DATA - .10000E+05 , -.952155E+00 , -.10000E+03 ,

. 862319E+00

0150 DATA - .50000E+02 , .964966E+00 , -.16000E+02 , -. 957659E+00

0160 DATA - .80000E+01 , -.145500E+00 , -.40000E+01 , 653644E+00

0170 DATA - .20000E+01 , -.416147E+00 , -.50000E+00 , . 877583E+00

0180 DATA - .10000E+00 , .995004E+00 , -.10000E-02 ,

. 100000E+01

0190 DATA - .10000E-04 , .100000E+01 , -.10000E-10 ,

. 100000E+01

0200 DATA - .10000E-24 , .100000E+01 , .00000 , . 100000E+01

0210 DATA .10000E-34 , .100000E+01 , .10000E-15 , . 100000E+01

0220 DATA .10000E-07 , .100000E+01 , .10000E-03 , . 100000E+01

0230 DATA .10000E-01 , .999950E+00 , .25000E+00 , . 968912E+00

0240 DATA .26179E+00 , .965928E+00 , .52360E+00 , . 866025E+00

0250 DATA . 75000E+00 , .731689E+00 , .78539E+00 , .707113E+00

0260 DATA .10000E+01 , .540302E+00 , .10472E+01 ,

. 499998E+00

0270 DATA .13089E+01 , .258913E+00 , .18325E+01 , -. 258727E+00

0280 DATA .20944E+01 , -.500004E+00 , .23561E+01 , -. 707040E+00

0290 DATA .26180E+01 , -.866028E+00 , .28797E+01 , 965902E+00

0300 DATA .30000E+01 , -.989992E+00 , .31416E+01 , -. 100000E+01

0310 DATA .34033E+01 , -.965950E+00 , .36652E+01 , -. 866021E+00

0320 DATA .39279E+01 , -.706464E+00 , .41888E+01 , -. 499992E+00

0330 DATA .44505E+01 , -.258906E+00 , .49741E+01 ,

. 258734E+00

0340 DATA .50000E+01 , .283662E+00 , .52360E+01 , . 500011E+00

0350 DATA . 549'77£+01 , .70-7045E+00 , .57596E+01 ,. 866032E+00

0360 DATA .60213E+01 , .965904E+00 , .62832E+01 ,

. 100000E+01

0370 DATA .11000E+02 , .442570E-02 , .25000E+02 ,

. 991203E+00

0380 DATA .75000E+02 , .921751E+00 , .10000E+04 ,. 562379E+00

0390 DATA .10000E+06 , -. 999361E+00

0400 DIM E ( 51)

13
0410 LET L = 0 0420 LET H = 0 0430 LET M = 0 0440 LET V = 0 0450 PRINT " ", " ", "RELATIVE"

0460 PRINT " ARGUMENT", "TEST VALUE", " SYSTEM VALUE", " ERROR"

0470 FOR I = 1 TO 51

0475 LET SI = 1 0480 READ X,Y

0490 LET A$ = " " 0500 LET Z = COS (X)

0501 IF ABS(Y) >= lE-38 THEN 508

0502 IF ABS(Z) >= lE-38 THEN 505

0503 LET E (I) = 0.0

0504 GO TO 580

0505 LET T1 = Y 0506 LET Y = Z 0507 LET Z = T1

0508 REM TEST Y FOR SCALING

0509 IF ABS(Y) <= 1E30 THEN 511

0510 LET SI = lE-8

0511 IF ABS(Y) >= lE-30 THEN 513

0512 LET SI = 1E8

0513 LET E{I) = ((S1*Z) - (Si *Y ) ) / (S 1 *Y ) 0514 LET E (I) = ABS (E (I)

)

0515 LET A1 = E (I

)

0516 LET Y2 = Y 0517 GOSUB 9000

0518 IF ABS(Al) < C THEN 580

0570 LET A$ = "****" 0580 PRINT X,Y,Z,E(I) ;A§

0590 NEXT I 0600 PRINT

0610 PRINT " EVALUATION OF THE ABSOLUTE HELATIVE

0620 PRINT " ERRORS"

0630 PRINT

0640 PRINT

0650 FOR I = 1 TO 51

0660 IF H > E(I) THEN 690

0670 LET H = E (I)

0680 GO TO 710

0690 IF L<= E(I) THEN 710

0700 LET L = E (I

)

0710 NEXT I 0820 PRINT

0830 PRINT " LOWEST ERROR =";L;" HIGHEST ERROR =";H

0840 PRINT

0930 PRINT " END TEST"

0940 PRINT

1000 GO TO 9400

9000 IF 1 <= ABS(Y2) THEN 9101

9001 LET S2 = 1 9003 IF ABS(Y2) > lE-37 THEN 9010

9005 LET P = lE-37

9007 LET S2 = 1E10

9009 GO TO 9200

9010 LET P = 1

] li
9020 LET PI = P/10

9030 IF PI <= ABS(Y2) THEN 9200

9040 LET P = P/10

9050 GO TO 9020

9101 LET S2 = 1 9105 IF ABS(Y2) <= 1E37 THEN 9110

9106 LET P = 1E38

9107 LET S2 = lE-10

9109 GO TO 9200

9110 LET P = 10

9120 IF ABS(Y2) < P THEN 9200

9130 LET P = P*10

9140 GO TO 9120

9200 LET Y1 = ABS (Y2)

9210 LET C = (. 5E-6) * ( (P*S2)/(Y1*S2)

)

9300 RETURN

9400 END

'k'kic^'k-kicic-kidc’k-kic'k’k-k * SAMPLE OUTPUT *

'kitit'k'kic'k’k-kiric-kicic’kifit

PROGRAM FILE 97

SECTION 97.0

COSINE FUNCTION (COS)

BEGIN TEST

ARGUMENT TEST VALUE

10000 -. 952155

100 . 862319

50 . 964966

16 -. 957659

8 -.1455

4 -. 653644

2 -. 416147

. 5 . 8^7583

. 1 . 995004

. 001 1

. 00001 1

1 . 00000E-11 1 1. 00000E-25 1 0 1 1. 00000E-35 1 1. 00000E-16 1

RELATIVE

SYSTEM VALUE ERROR

-.952155 0 .862319 0 ,964966 0 -.95766 0 -.1455 0 -.653644 0 -.416147 0 .877583 0 .995004 0

1 0

1 0

1 0

1 0

1 0 1 0

1 0

15
1. 00000E-8 1 1 0

. 0001 1 1 0

. 01 . 99995 . 99995 0

. 25 . 968912 . 968912 0

. 26179 . 965928 . 965928 0

. 5236 . 866025 . 866025 0 .75 . ''31689 . -731689 0

. 78539 . 707113 . 707113 0

1 . 540302 . 540302 0 1.0472 . 499998 . 499998 0 1.3089 . 258913 . 258913 0 1.8325 258^27 -. 258-727 0 2.0944 -. 500004 -. 500004 0 2.3561 70-704 -. 70-704 0 2.618 -.866028 -.866028 0 2.8797 -.965902 -.965902 0

3 -. 989992 -. 989992 0 3.1416 -1 -1 0 3.4033 -.96595 -. 96595 0 3.6652 -. 866021 -. 866021 0 3.9279 -. 706464 -. -706464 0 4.1888 -.499992 -.499992 0 4.4505 -. 258906 -. 258906 0 4.9741 . 258''34 . 258734 0

5 . 283662 . 283662 0 5.236 . 500011 . 500011 0 5.4977 . 707045 . -707045 0 5.7596 . 866032 .866032 0 6.0213 . 965904 . 965904 0 6.2832 1 1 0 11 4. 42570E-3 4. 42570E-3 0 25 . 991203 . 991203 0

->5

. 921''51 .921751 0 1000 . 562379 . 562377 0 100000 -. 999361 -. 999361 0 EVALUATION OF THE ABSOLUTE RELATIVE ERRORS

LOWEST ERROR 0 HIGHEST ERROR 0 END TEST

l6
98.0 THE EXP FUNCTION

The objective of this test is to introduce the use of the EXP function

by sampling the accuracy maintained by the implementation-supplied function

(see section 8 of BSR X3.60). EXP computes the value of the base of the

natural logarithms raised to the power of the argument. The test, except for

the use of the EXP function instead of the SQR function, is the same in

structure and output format to section 94.0.

If EXP(X) is less than the local machine infinitesimal, then its value

is replaced by zero. The Minimal BASIC standard recommends that underflow be

reported as an exception, but it is not required to do so. These remarks are made because the following routine may generate reported underflows on some systems. These occur because of the nonstandard procedures for computing the

mathematical functions. A good function should not underflow on this test.

The routines should have internal traps that return a function value of 0 when an argument, with the allowed range of numerical representation,

produces an underflow.

‘k'kif-k-kificit’kif'kicic'kit'k'kie-k * PROGRAM FILE 98 *

•k-k'kicicit'kic'kicicilie-kicicitifit

0010

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

01'»0

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

"PROGRAM FILE

tl

II

II DATA -. 10000E+36 f DATA -. 10000E+03 r DATA -. 50000E+02 t DATA -. 18421E+02 9 DATA -. 92103E+01 9 DATA -. 46052E+01 9 DATA -. 23979E+01 9 DATA -. 16094E+01 9 DATA -. 33333E+00 9 DATA . 25000E+00 9 DATA . 69315E+00 9 DATA . 13863E+01 9 DATA . 23026E+01 9 DATA . 50000E+01 9 DATA . 11000E+02 9 DATA . 25000E+02 9

98

EXPONENTIAL FUNCTION

.000000 , .000000

.192875E-21 , .999681E-08 , .100004E-03 , .999970E-02 , .909087E-01 , .200008E+00 , .716534E+00 , .128403E+01 , .200001E+01 , .400002E+01 , .100001E+02 , .148413E+03 ,

. 598'74lE+05 , .720049E+11 ,

SECTION 98.0"

BEGIN TEST"

-.10000E+11 , -.80590E+02 , -.36841E+02 , -.16000E+02 , -.80000E+01 , -.40000E+01 , -.20000E+01 , -.10986E+01 , .00000 , .50000E+00 , .10000E+01 , .20794E+01 , .27726E+01 , .69078E+01 , .11513E+02 , .25328E+02 ,

(EXP)

. 000000

. 100048E-34

. 100036E-15

. 112535E-06

. 335463E-03

. 183156E-01

. 135335E+00

. 333337E+00

. 100000E+01

. 164872E+01

. 271828E+01

. 799967E+01

. 160002E+02

. 100004E+04

. 100007E+06

. 999564E+11

IT
0300 DATA .46052E+02 , .100030E+21 , .75000E+02 , .373324E+33

0310 DATA .85000E+02 , .822301E+37

0320 DIM E(40)

0330 LET L = 0 0340 LET H = 0 0350 LET M = 0 0360 LET V = 0 0370 PRINT " ", " ", " ", "RELATIVE"

0380 PRINT " ARGUMENT" , " TEST VALUE" , " SYSTEM VALUE" , " ERROR"

0390 FOR I = 1 TO 35

0395 LET SI = 1 0400 READ X, Y 0410 LET A$ = " " 0420 LET Z = EXP(X)

0421 IF ABS(Y) >= lE-38 THEN 428

0422 IF ABS(Z) >= lE-38 THEN 425

0423 LET E (I ) = 0-0

0424 GO TO 500

0425 LET T1 = Y 0426 LET Y = Z 0427 LET Z = T1

0428 REM TEST Y FOR SCALING

0429 IF ABS(Y) <= 1E30 THEN 431

0430 LET SI = lE-8

0431 IF ABS(Y) '>= lE-30 THEN 433

0432 LET SI = 1E8

0433 LET E(I) = {(S1*Z) - (S 1 *Y ) ) / (S 1 *Y ) 0444 LET E (I ) = ABS (E (I )

)

0445 LET Al = E (I

)

0446 LET Y2 = Y

0447 GOSUB 9000

0448 IF ABS(Al) < C THEN 500

0490 LET A$ = "****" 0500 PRINT X,Y,Z,E(I) ;A$

0510 NEXT I 0520 PRINT

0530 PRINT " EVALUATION OF THE ABSOLUTE RELATIVE";

0540 PRINT " ERRORS"

0550 PRINT

0560 PRINT

05'70 FOR I = 1 TO 35

0580 IF H > E (I ) THEN 610

0590 LET H = E (I

)

0600 GO TO 630

0610 IF L <= E (I ) THEN 630

0620 LET L = E (I

)

0630 NEXT I 0740 PRINT

0750 PRINT " LOWEST ERROR =";L;" HIGHEST ERROR =";H

0760 PRINT

0850 PRINT " END TEST"

0860 PRINT

0880 GO TO 9400

9000 IF 1 <= ABS(Y2) THEN 9101

9001 LET S2 = 1 9003 IF ABS(Y2) > lE-37 THEN 9010

9005 LET P = lE-37

18
9007 LET S2 = 1E10

9009 GO TO 9200

9010 LET P = 1 9020 LET PI = P/10

9030 IF PI <= ABS(Y2) THEN 9200

9040 LET P = P/10

9050 GO TO 9020

9101 LET S2 = 1 9105 IF ABS(Y2) <= 1E37 THEN 9110

9106 LET P = 1E38

9107 LET S2 = lE-10

9109 GO TO 9200

9110 LET P = 10

9120 IF ABS(Y2) < P THEN 9200

9130 LET P = P*10

9140 GO TO 9120

9200 LET Y1 = ABS (Y2)

9210 LET C = (. 5E-6) * ( (P*S2)/(Y1*S2)

)

9300 RETURN

9400 END

'k'kic'k'k'k-k'k'kicic-k-kicicicic * SAMPLE OUTPUT *

k-kii-k-k-kii-k-k-itic-k-kliii-kic

PROGRAM FILE 98

SECTION 98,0

EXPONENTIAL FUNCTION (EXP)

BEGIN TEST

RELATIVE

ARGUMENT TEST VALUE SYSTEM VALUE ERROR

-1. 00000E+35 0 0 0 -1. 00000E+10 0 0 0 -100 0 0 0 -80.59 1. 00048E-35 1. 00048E-35 0 -50 1. 928’75E-22 1. 92875E-22 0 -36.841 1. 00036E-16 1. 00036E-16 0 -18.421 9. 99681E-9 9. 99681E-9 0 -16 1, 12535E-7 1. 12535E-7 0 -9.2103 1. 00004E-4 1. 00004E-4 0 -8 3. 35463E-4 3. 35463E-4 0 -4.6052 9. 99970E-3 9. 99970E-3 0 -4 1. 83156E-2 1.83156E-2 0 -2. 39'79 9. 09087E-2 9. 09087E-2 0

19
-2 . 135335 .135335 0 -1,6094 . 200008 . 200008 0 -1.0986 . 333337 . 333337 0 33333 . '^16534 . ’16534 0

0 1 1 0

. 25 1.28403 1.28403 0

. 5 1.64872 1. 648'’2 0

. 69315 2.00001 2.00001 0 1 2.71828 2.^1828 0 1.3863 4.00002 4 . 00002 0 2.0794 7.99967 .7.9996"’ 0 2.3026 10.0001 10-. 0001 0 2.7726 16.0002 16.e002 0 5 148.413 148.413 0 6.9078 1000. 04 1000. 04 0 11 598''4,

1

598^4.1 0 11.513 100007 100007 0 25 7. 20049E+10 7. 20049E+10 0 25.328 9. 99564E+10 9. 99564E+10 0 46.052 1. 00030E+20 1. 00030E+20 0 75 3. T3324E+32 3, 73324E+32 0 85 8. 22301E+36 8. 22301E+36 0 EVALUATION OF THE ABSOLUTE RELATIVE ERRORS

LOWEST ERROR = t) HIGHEST ERROR = k)

END TEST

20
99.0

EXCEPTION TEST FOR THE EXP FUNCTION

The objective of this test is to determine whether the implementation

recognizes certain exceptions for the EXP function (see section 8.5 of BSR

X3.60)* In particular, this section examines two cases when the

evaluation of the Exponential Function results in an overflow. If the

implementation recognizes, reports and assigns the proper sign to its

implementation-defined machine infinity for any overflov/, then the system

will have passed the test.

99.1

Positive Machine-Infinity

This test uses an argumen

380. For most machines avai

output, the test prints a mess

the positive case of the

system being tested, since an This use of an EXP function

returned. There should also

machine overflow was encounter

t value of 99999 for the EXP function in

lable, this value should cause an overflow

age warning the user to look for a printou

implementation-defined machine- i nf i n i ty fo

unsigned EXP function

means that a positive

be some diagnostic

ed

.

is used in line

machine infinity mu report indicating

line

. On

t of

r the

380.

St be

that

99.2

Negative Machine-Infinity

This test has a negative assignment of the EXP function, using an argument value of 99999 in line 520. On output, the test has a message which

asks the user to look for a printout of the negative case of the

implementation-defined machine infinity for the system being tested. A

diagnostic indicating machine overflow should also be printed.

^**^**A**:^- A ******

* PROGRAM FILE 99 *****************

* *

* * *

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

"PROGRAM FILE 99"

" SECTION 99.0; EXCEPTION TEST FOR THE EXP FUNCTION."

" THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

"THIS SYSTEM RECOGNIZES THE FOLLOWING PROCEDURE;"

" TO SUPPLY MACHINE INFINITY WITH THE APPROPRIATE SIGN"

"AND CONTINUE PROGRAM EXECUTION IF THE EVALUATION OF THE EX-"

"PONENTIAL FUNCTION RESULTS IN AN OVERFLOW."

21
0220

0230

0240

0250

0260

0270

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0 500

0510

0520

0530

0540

0550

0560

0570

0580

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET y

PRINT

PRINT

PRINT

PRINT

PRINT

END

"IF SUCH RECOGNITION IS MADE BY THIS SYSTEM, THEN CONSIDER

"IT TO HAVE PASSED THE TEST."

" SECTION 99.1: POSITIVE MACHINE INFINITY."

" BEGIN TEST."

EXP(99999) • . "IF THE NUMERICAL VALUE FOR THE POSITIVE MACHINE INFINITY"

"OF THIS SYSTEM FOLLOWS THIS STATEMENT, THEN CONSIDER THE"

"SYSTEM TO HAVE PASSED THE TEST."

y

END TEST.

SECTION 99.2: NEGATIVE MACHINE INFINITY."

BEGIN TEST."

-EXP(99999)

"IF THE NUMERICAL VALUE FOR THE NEGATIVE MACHINE INFINITY"

"OF THIS SYSTEM FOLLOWS THIS STATEMENT, THEN CONSIDER THE"

"SYSTEM TO HAVE PASSED THE TEST."

Y

tl

k’k-k'k-k'kicic-k-kic’kicicicifit * SAMPLE OUTPUT *

•kiticicir'kiiiciticif'k'kif-k'kit

PROGRAM FILE 99

SECTION 99.0: EXCEPTION TEST FOR THE EXP FUNCTION.

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

THIS SYSTEM RECOGNIZES THE FOLLOWING PROCEDURE:

TO SUPPLY MACHINE INFINITY WITH THE APPROPRIATE SIGN

AND CONTINUE PROGRAM EXECUTION IF THE EVALUATION OF THE EXPONENTIAL FUNCTION RESULTS IN AN OVER FLOW.

22
IF SUCH RECOGNITION IS MADE BY THIS SYSTEM, THEN CONSIDER

IT TO HAVE PASSED THE TEST.

; SECTION 99.1: POSITIVE MACHINE INFINITY.

I BEGIN TEST.

70VERFL0W IN EXP IN LINE 380

IF THE NUMERICAL VALUE FOR THE POSITIVE MACHINE INFINITY

I OF THIS SYSTEM FOLLOWS THIS STATEMENT, THEN CONSIDER THE

1 SYSTEM TO HAVE PASSED THE TEST.

! 1.70141E+38

END TEST.

SECTION 99.2: NEGATIVE MACHINE INFINITY.

BEGIN TEST.

70VERFL0W IN EXP IN LINE 520

IF THE NUMERICAL VALUE FOR THE NEGATIVE MACHINE INFINITY

OF THIS SYSTEM FOLLOWS THIS STATEMENT, THEN CONSIDER THE

SYSTEM TO HAVE PASSED THE TEST.

-1. 70141E+38

23
IBM.fc) UNDERFLOW OF THE EXPONENTIAL FUNCTION

This

underflow

test

will

verifies that the

be recognized, and

evaluation of

the implementation to the EXP function (:

an EXP function causing

a value assignment of zero will be given by

.see section 8.6 of BSR X3.60)-

-99999 in line 170 is assigned as an argument value for the EXP function. On

output, the test has a message which warns the user to look for a printout

value of zero by the system being tested. The standard recommends that a system report an underflow when the exponential function produces a machine

inf i ni tess imal value or less.'

icic-kicitieicif'k'kic'k'kif'kicicic’kit * PROGRAM FILE 100 *

0010 PRINT

0060 PRINT

00"?0 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

01'70 LET Y 0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 END

"PROGRAM FILE 100"

" SECTION 100.0"

" (EVALUATION OF THE EXPONENTIAL FUNCTION RESULTS IN AN UNDER

" FLOW.)"

BEGIN TEST."

=EXP (-999999)

"IF THE NUMERICAL VALUE OF ZERO FOLLOWS THIS STATEMENT, THEN

"CONSIDER THE SYSTEM TO HAVE PASSED TEST."

Y END TEST.

* SAMPLE OUTPUT *

2h
PROGRAM FILE 100

SECTION 100.0

(EVALUATION OF THE EXPONENTIAL FUNCTION RESULTS IN AN UNDER

FLOW.

)

BEGIN TEST.

7UNDERFLOW IN EXP IN LINE 170

IF THE NUMERICAL VALUE OF ZERO FOLLOWS THIS STATEMENT, THEN

CONSIDER THE SYSTEM TO HAVE PASSED TEST.

0 END TEST,
101.0 THE LOG FUNCTION

This test introduces the use of the LOG function by sampling the

accuracy of this implementation-supplied function. The function returns the

natural logarithm of an argument that must be greater

except for the use of the LOG

similar in structure and output format

referred to section 8 of BSR X3.60

than zero. The test,

function instead of the SQR function, is

to section 94.0. The reader is

icicicicic'kicic'kificitic-k'k'kit-kic'k * PROGRAM FILE 101 *

ic-kic-k-k-kitif-kic-kicicicic-kilic-k-k

0010 PRINT "PROGRAM FILE 101"

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT II SECTION 101 . 0"

0100 PRINT

0110 PRINT II NATURAL LOG FUNCTION (LOG)"

0120 PRINT

0130 PRINT 11 BEGIN TEST"

0140 DATA . 10000E-19 t -. 460517E+02 9 . 10000E-07 , -.184207E+02

0150 DATA . 11254E-06 t -. 160000E+02 9 . 10000E-04 , -.115129E+02

0160 DATA . 33546E-03 9 -. 800001E+01 9

. 10000E-01 , -. 46051"’E + 01

0170 DATA . 18316E-01 t -. 399998E+01 9

. 31250E-01 , -.346574E+01

0180 DATA . 90909E-01 t -. 239''90E+01 9 . 13534E+00 , -.199997E+01

0190 DATA . 20000E+00 t -. 160944E+O1 9. 33333E+00 , -.109862E+01

0200 DATA . 50000E+00 9 -. 69314TE+00 9

. 75000E+00 , -.287682E+00

0210 DATA . 90000E+00 9 -. 105361E+00 9

. 99000E+00 , -.100503E-01

0220 DATA . 99900E+00 9 -. 100050E-02 9 . 99990E+00 , -.100005E-03

0230 DATA . 99999E+00 9 -. 100001E-04 9 . 10000E+01 , .000000

0240 DATA . 10001E+01 9 .999950E-04 9

. 10010E+01 , .999500E-03

0250 DATA . 10100E+01 9 . 995033E-02 9 . 11000E+01 , .953102E-01

0260 DATA . 15000E+01 9 . 405465E+00 9. 20000E+01 , .693147E+00

0270 DATA . 27183E+01 9

. 100001E + 01 9

. 40000E+01 , .138629E+01

0280 DATA . 80000E+01 9 . 207944E+01 9 . 10000E+02 , .230259E401

0290 DATA . 16000E+02 9 . 2'77259E + 01 9 . 20086E+02 , .300002E+01

0300 DATA . 64000E+02 9

. 4L5888E+01 9 . 14841E+03 , .499998E+01

0310 DATA . 10000E+04 9

. 690'»'76E + 01 9

. 1000OE+05 , .921034E+01

0320 DATA . 59874E+05 9 . 110000E+02 9 . 10000E+11 , .230259E+02

0330 DATA . 10000E+36 9 . 805905E+02

0340 DIM E ( 39)

0350 LET L = 0 0360 LET H = 0 0370 LET M = 0 0380 LET V = 0 0390 PRINT If II II II 11 / f

II , "RELATIVE"

i

ii

2b
I

0400 PRINT " ARGUMENT", " TEST VALUE", " SYSTEM VALUE", " 0410 FOR I = 1 TO 39

0415 LET SI = 1 0420 READ X,Y

0430 LET A$ = " " 0440 LET Z = LOG (X)

0441 IF ABS(Y) >= lE-38 THEN 448

0442 IF ABS(Z) >= lE-38 THEN 445

0443 LET E (I) = 0.0

0444 GO TO 520

0445 LET T1 = Y 0446 LET Y = Z 0447 LET Z = T1

0448 REM TEST Y FOR SCALING

0449 IF ABS(Y) <= 1E30 THEN 451

0450 LET SI = lE-8

0451 IF ABS(Y) >= lE-30 THEN 453

0452 LET SI = 1E8

0453 LET E(I) = ((S1*Z) - (S 1 *Y ) ) / (Si *Y

)

0454 LET E (I) = ABS (E (I)

)

0455 LET A1 = E (I

)

0456 LET Y2 = Y

045'7 GOSUB 9000

0458 IF ABS(Al) < C THEN 520

0510 LET A$ = "****"

0520 PRINT X,Y,Z,E(I) ;A$

0530 NEXT I 0540 PRINT

0550 PRINT " EVALUATION OF THE ABSOLUTE RELATIVE

0560 PRINT " ERRORS"

0570 PRINT

0580 PRINT

0590 FOR I = 1 TO 39

0600 IF H > E (I ) THEN 630

0610 LET H = E (I

)

0620 GO TO 650

0630 IF L <= E(I) THEN 650

0640 LET L = E (I

)

0650 NEXT I 0760 PRINT

0770 PRINT " LOWEST ERROR = " ; L

; " HIGHEST ERROR =";H

0780 PRINT

08'70 PRINT " END TEST"

0880 PRINT

0890 GO TO 9400

9000 IF 1 <= ABS(Y2) THEN 9101

9001 LET S2 = 1 9003 IF ABS(Y2) > lE-3'’ THEN 9010

9005 LET P = lE-37

9007 LET S2 = 1E10

9009 GO TO 9200

9010 LET P = 1 9020 LET PI = P/10

9030 IF PI <= ABS(Y2) THEN 9200

9040 LET P = P/10

9050 GO TO 9020

9101 LET S2 = 1

ERROR"

27
9105 IF ABS(Y2) <= 1E37 THEN 9110

9106 LET P = 1E38

9107 LET S2 = lE-10

9109 GO TO 9200

9110 LET P = 10

9120 IF ABS(Y2) < P THEN 9200

9130 LET P = P*10

9140 GO TO 9120

9200 LET Y1 = ABS (Y2)

9210 LET C = (. 5E-6) * ( (P*S2)/(Y1*S2)

)

9300 RETURN

9400 END

'k'kie-k'kicit-kic'k'k'k-k-k'kitit * SAMPLE OUTPUT *

'kicif-kisitic-kicic’k'k'kicicifit

PROGRAM FILE 101

SECTION 101.0

NATURAL LOG FUNCTION (LOG)

BEGIN TEST

RELATIVE

ARGUMENT TEST VALUE SYSTEM VALUE ERROR

. 00000E-20 -46.0517 -46.0517 0

. 00000E-8 -18.4207 -18.4207 0

. 12540E-7 -16 -16 0 00001 -11. 5129 -11.5129 0

. 35460E-4 -8.00001 -8 . 00001 0 01 -4. 6051'7 -4.60517 0 018316 -3.99998 -3.99998 0

. 12500E-2 -3.46574 -3. 465''4 0

. 09090E-2 -2.3979 -2.3979 0 13534 -1. 9999'7 -1.99997 0

2 -1.60944 -1.60944 0 33333 -1.09862 -1.09862 0

5 -. 69314'7 -. 69314T 0 75 -. 287682 -. 287682 0

9 -.105361 -. 105361 0 99 -1. 00503E-2 -1. 00503E-2 0 999 -1. 00050E-3 -1. 00050E-3 0 9999 -1. 00005E-4 -1. 00005E-4 0 99999 -1 . 00001E-5 -1. 00001E-5 0

0 0 0

. 0001 9. 99950E-5 9. 99950E-5 0

28
1.001 9. 99500E-4 9. 99500E-4 0 1.01 9. 95033E-3 9. 95033E-3 0 1.1 9. 53102E-2 9. 53102E-2 0 1.5 . 405465 . 405465 0

2 . 693147 . 69314‘7 0 2.7183 1.00001 1. 00001 0

4 1.38629 1.38629 0

8 2.07944 2.07944 0 10 2. 30259 2.30259 0 16 2. 7-'259 2.77259 0 20.086 3.00002 3.00002 0 64 4.15888 4.15888 0 148.41 4.99998 4.99998 0 1000 6. 907-76 6.90776 0 10000 9.21034 9.21034 0 59874 11 11 0 1. 00000E+10 23.0259 23.0259 0 1. 00000E+35 80.5905 80.5905 0 EVALUATION OF THE ABSOLUTE RELATIVE ERRORS

LOWEST ERROR = 0 HIGHEST ERROR = 0 END TEST

29
102.0 EXCEPTION TEST FOR THE LOG FUNCTION WITH

A ZERO ARGUMENT

The objective of this test is to verify that the evaluation of the LOG

a zero argument will be recognized as an exception by the

>eing tested (see section 8.5 of bSR X3.60). This

exception when encountered must be reported by a Minimal BASIC processor. To

ment the program below assigns a LOG function with an argument value of zero in line 290. According to the ANSI Minimal BASIC

standard, this exception should be handled by the implementation first by

reporting the exception, and then terminating the program.

The obj ec tion wi th

ement ati on ption when

this re qu

* PROGRAM FILE 102 * A***********

0010

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0190

0200

0210

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

PRINT "PROGRAM FILE 102"

PRINT

PRINT

PRINT

PRINT " SECTION 102.0: EXCEPTION TEST FOR THE LOG FUNCTION"

PRINT " WHEN THE ARGUMENT IS ZERO."

PRINT

PRINT

PRINT " THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

PRINT " THIS SYSTEM RECOGNIZES THE USE OF A ZERO " PRINT " FOR THE ARGUMENT OF THE LOG FUNCTION AS AN EXCEPTION"

PRINT "THE SYSTEM MUST REPORT THE EXCEPTION AND TERMINATE PROGRAM"

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Y=LOG(0)

PRINT "IF A NUMERICAL VALUE IS PRINTED AFTER THIS STATEMENT,"

PRINT "CONSIDER SYSTEM TO HAVE FAILED TEST."

PRINT Y

PRINT

PRINT " END TEST."

PRINT

END

it’kitifif'k'kicicIC’k-k-kiiifit-A * SAMPLE OUTPUT *

30
k'kicie'k'kicicTfi:'it-k-k'k-k'k-k‘k

PROGRAM FILE 102

SECTION 102.0: EXCEPTION TEST FOR THE LOG FUNCTION

WHEN THE ARGUMENT IS ZERO.

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

THIS SYSTEM RECOGNIZES THE USE OF A ZERO

FOR THE ARGUMENT OF THE LOG FUNCTION AS AN EXCEPTION

THE SYSTEM MUST REPORT THE EXCEPTION AND TERMINATE PROGRAM

BEGIN TEST.

?LOG OF ZERO IN LINE 290

31
103.0 EXCEPTION TEST FOR THE LOG FUNCTION WITH A

NEGATIVE ARGUMENT

The objective of this test is to verify that the implementation will

recognize as an exception the evaluation of the LOG function with a negative

value as an argument (see section 8.5 of BSR X3.60).

This test has an assignment of LOG using a negative argument in line

160. Some present systems, however, ignore the negative value and return the

LOG of the absolute value of "the argument. This would be considered a failure, since the program should have terminated with a report on the

exception. In fact, on output, there should be implementation-defined

diagnostic. Otherwise, the test program below has an internal message

indicating system failure.

* PROGRAM FILE 103 *

ic’kiticic-kiriciticif'kililifisificirir

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 LET Y 0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 END

"PROGRAM FILE 103"

SECTION 103.0"

EXCEPTION TEST FOR THE LOG FUNCTION"

THE VALUE OF THE ARGUMENT IS NEGATIVE

BEGIN TEST."

LOG (-16)

"IF A NUMBERICAL VALUE IS PRINTED AFTER THIS STATEMENT,

"CONSIDER SYSTEM TO HAVE FAILED TEST."

Y END TEST."

M

-kic-kitic-kititit-kititic-k'kicit * SAMPLE OUTPUT *

irificicicieic-k'k’k'k^'kir'kic’k

V 32
PROGRAM FILE 103

SECTION 103.0

EXCEPTION TEST FOR THE LOG FUNCTION

THE VALUE OF THE ARGUMENT IS NEGATIVE.

BEGIN TEST.

?LOG OF NEGATIVE NUMBER IN LINE 160

33
The object of

a test sampling

function (see sect

a legitimate arg

actual test is sim

this

the

ion 8 ument

ilar

104.0 THE SIN FUNCTION

test is to introduce the use of the SIN function with i accuracy maintained by the i mplementat i on-suppl i ed i of BSR X3.60). Every allowable numeric value is

| . Arguments are of course assumed to be radians. The i to section 94.0.

* PROGRAM FILE 104 *

I

0010

0060

0070

0080

0090

0100

0110

0120

0130

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

"PROGPIAM FILE

H

It

II

104"

SECTION 104.0"

SINE FUNCTION (SIN)

BEGIN TEST"

0140 DATA - . 10000E+0 5 t

. 305614E+00 -. 10000E+03 . 506366E+00

0150 DATA - . 50000E+02 t . 2623-75E+00 -. 16O00E+02 . 28-7903E + 00

0160 DATA - . 80000E+01 t -. 989358E+00 -. 40000E+01 . -756803E + 00

0170 DATA - . 20000E+01 t 90929-7E+00 -. 50000E+00 -. 4-79426E + 00

0180 DATA - . 10000E+00 9 -. 998334E-01 -. 10000E-02 -. 100000E-02

0190 DATA - . 10000E-04 9 -. 100000E-04 -. 10000E-10 -. 100000E-10

0200 DATA - . 10000E-24 9 -. 100000E-24 . 00000 . 000000

0210 DATA . 10000E-34 9 . 100000E-34 . 10000E-15 . 100000E-15

0220 DATA , 10000E-0-7 9

. 100000E-0'7 . 10000E-03 . 100000E-03

0230 DATA . 10000E-01 9

. 999983E-02 . 25000E+00 . 24-7404E + 00

0240 DATA . 261‘79E+00 9 . 258810E+00 . 52360E+00 . 500001E+00

0250 DATA . "75000E+00 9 . 681639E+00 . -78539E + 00 . '0-7101E + 00

0260 DATA . 10000E+01 9 . 8414-71E+00 . 104-72E + 01 . 86602‘'E + 00

02'70 DATA . 13089E+01 9 . 965901E+00 . 15'»08E + 01 . 100000E+01

0280 DATA . 18325E+01 9

. 965951E+00 . 20944E+01 . 866023E+00

0290 DATA . 23561E+01 9

. 707174E+00 . 26180E+01 . 499995E+00

0300 DATA . 28’?9''E+01 9 . 258909E+00 . 30000E+01 . 141120E+00

0310 DATA . 34033E+01 9 258-730E+00 . 36652E+01 50000-7E + U0

0320 DATA . 39279E+01 9 -. 707-749E+00 . 41888E+01 866030E+00

0330 DATA . 44505E+01 9 -. 965903E+00 . 4-7124E + 01 -. 100000E+01

0340 DATA . 49-741E+01 9 -. 965949E+00 . 50000E+01 -. 958924E+00

0350 DATA . 52360E+01 9 866019E+00 . 549-77E + 01 -. 70-7168E + 00

0360 DATA . 5-7596E+01 9 -. 499988E+00 . 60213E+01 258902E+O0

03-70 DATA , 11000E+02 9 999990E+00 . 25000E+02 -. 132352E+00

0380

0390

0400

DATA

DATA

DIM E(

. 75000E+02

. 10000E+06

51)

9

9

-. 38'?'782E + 00

. 35'7488E-01

. 10000E+04 . 826880E+00
0410

0420

0430

0440

0450

0460

0470

0475

0480

0490

0500

0501

0502

0503

0504

0505

0506

050T

0508

0509

0510

0511

0 512

0513

0514

0515

0516

0517

0518

05'70

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0820

0830

0840

0930

0940

0950

9000

9001

9003

9005

9007

9009

9010

LET L = 0 LET H = 0 LET M = 0 LET V = 0 PRINT " ", " ", " ", "RELATIVE"

PRINT " ARGUMENT", " TEST VALUE", " SYSTEM VALUE", " FOR I = 1 TO 51

LET SI = 1 READ X,Y

LET A$ = " " LET Z = SIN (X)

IF ABS{Y) >= IE-38 then 508

IF ABS(Z) >= lE-38 THEN 505

LET E (I ) = 0.0

GO TO 580

LET T1 = Y LET Y = Z LET Z = T1

REM TEST Y FOR SCALING

IF ABS(Y) <= 1E30 THEN 511

LET SI = lE-8

IF ABS{Y) >= lE-30 THEN 513

LET SI = 1E8

LET E(I) = ((S1*Z) - (S1*Y) )/(Sl*Y)

LET E (I ) = ABS (E (I )

)

LET A1 = E (I ) LET Y2 = Y GOSUB 9000

IF ABS (Al) < C THEN 580

LET A$ = "****" PRINT X,Y,Z,E{I) ;A$

NEXT I PRINT

PRINT " EVALUATION OF THE ABSOLUTE RELATIVE";

PRINT " ERRORS"

PRINT

PRINT

FOR I = 1 TO 51

IF H > E (I) THEN 690

LET H = E (I

)

GO TO 710

IF L <= E (I ) THEN "710 LET L = E ( I

)

NEXT I PRINT

PRINT " LOWEST ERROR = " ; L

; “ HIGHEST ERROR = ";H

PRINT

PRINT " END TEST"

PRINT

GO TO 9400

IF 1 <= ABS(Y2) THEN 9101

LET S2 = 1 IF ABS(Y2) IE-3'7 THEN 9010

LET P = IE-3'7

LET S2 = 1E10

GO TO 9200

LET P = 1

ERROR"

35
9020 LET PI = P/10

9030 IF PI <= ABS (Y2) THEN 9200

9040 LET P = P/10

9050 GO TO 9020

9101 LET S2 = 1 9105 IF ABS (Y2) <= 1E37 THEN 9110

9106 LET P = 1E38

9107 LET S2 = lE-10

9109 GO TO 9200

9110 LET P = 10

9120 IF ABS (Y2) < P THEN 9200

9130 LET P = P*10

9140 GO TO 9120

9200 LET Y1 = ABS (Y2)

9210 LET C = (.5E-6)* ( (P*S2)/(Y1*

9300 RETURN

9400 END

’k’kicir'k'kif-kkic'k'kfcif-kitis * SAMPLE OUTPUT *

k'k'k-kicit’k'kicicit-k’k-kicit-k

PROGRAM FILE 104

SECTION 104.0

SINE' FUNCTION (S IN)

BEGIN TEST

RELATIVE

ARGUMENT TEST VALUE SYSTEM VALUE ERROR

-10000 . 305614 . 305614 0 -100 . 506366 . 506366 0 -50 . 262375 . 262375 0 -16 . 287903 . 287903 0 -8 -.989358 -.989358 0 -4 . 756803 . 756803 0 -2 -. 90929'' -. 90929'' 0 -. 5 -. 4'79426 -. 4'79426 0 -. 1 -9. 98334E-2 -9. 98334E-2 0 - . 001 -. 001 -. 001 0 -.00001 -.00001 -. 00001 0 -1. 00000E-11 -1. 00000E-11 -1. 00000E-11 0 -1. 00000E-25 -1. 00000E-25 -1.00000E-25 0

0 0 0 0 1. 00000E-35 1. 00000E-35 1. 00000E-35 0 1. 00000E-16 1. 00000E-16 1. 00000E-16 0

36
1.00000E-8 1.00000E -8 1. 00000E-8 0

. 0001 . 0001 . 0001 0 .01 9. 99983E -3 9. 99983E-3 0

. 25 . 24'7404 . 24'7404 0

. 26179 . 25881 . 25881 0

. 5236 . 500001 . 500001 0 .75 . 681639 . 681639 0

. 78539 . 707101 . 707101 0

1 . 841471 . 8414''! 0 1.0472 . 866027 . 866027 0 1.3089 . 965901 . 965901 0 1.5708 1 1 0 1.8325 . 965951 . 965951 0 2.0944 . 866023 . 866023 0 2.3561 . 707174 . 707174 0 2.618 . 499995 . 499995 0 2.8797 . 258909 , 258909 0 3 .14112 . 14112 0 3.4033 -. 25873 -. 25873 0 3.6652 500007 — , 500007 0 3.9279 -.707749 -.707749 0 4.1888 -.86603 -. 86603 0 4.4505 -.965903 -.965903 0 4.7124 -1 -1 0 4.9741 -. 965949 -.965949 0 5 -. 958924 -. 958924 0 5.236 -.866019 -.866019 0 5.4977 -.^07168 -.707168 0 5.7596 -. 499988 -. 499988 0 6.0213 -. 258902 -. 258902 0 11 -. 99999 -.99999 0 25 -. 132352 -. 132352 0 75 -. 38‘7782 -. 387782 0 1000 . 82688 .82688 0 100000 3. 57488E -2 3. 5’’488E-2 0 EVALUATION OF THE ABSOLUTE RELATIVE

LOWEST ERROR = 0 HIGHEST ERROR

END TEST

37
105.0 THE TAN FUNCTION

This test introduce the use of tne TAN function by sampling the accuracy

maintained by the implementation-supplied function (see section 8 of BSR

X3.60), The argument in the tangent function is assumed to be in

radians. Since the tangent function becomes unbounbed near odd muJtipes of

pi/2, it is at these points in the testing that the user should look for

accuracy deterioration. There might also be loss of accuracy near the zeroes

of the tangent function too. The actual test is similar to section 94.0.

k'k'k'k-kifific-k * PROGRAM FILE 105 *

0010 PRINT "PROGRAM FILE 105"

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT II SECTION 105. 0"

0100 PRINT

0110 PRINT n TANGENT FUNCTION (TAN)"

0120 PRINT

0130 PRINT II BEGIN TEST"

0140 DATA - . 10000E + 05 -. 3209''lE + 00 , -.10000E+03 , . 58''214E + 00

0150 DATA - . 50000E+02 .2''190lE + 00 , -.16000E+02 , -. 300632E+00

0160 DATA - . 80000E+01 . 6‘799'71E+01 , -.40000E+01 , -. 115'782E + 01

01''0 DATA - . 20000E+O1 .218504E+01 , -.50000E+00 , -. 546302E+0O

0180 DATA - . 10000E+00 -. 100335E+00 , -.10000E-02 , -. 100000E-02

0190 DATA - . 10000E-04 -.100000E-04 , -.10000E-10 , -. 100000E-10

0200 DATA - . 10000E-24 -.100000E-24 , .00000 ,

. 000000

0210 DATA . 10000E-34 .100000E-34 , .10000E-15 , . 100000E-15

0220 DATA . 10000E-0"’ . 100000E-0'' , .10000E-03 ,

. 100000E-03

0230 DATA . 10000E-01 •100003E-O1 , .25000E+00 ,. 255342E+00

0240 DATA . 261'79E+00 .26T939E+O0 , .52360E+00 ,. 5"'''352E + O0

0250 DATA . •75000E + 00 .931596E+00 , .’’8539E + 00 , . 999-984E + 00

0260 DATA . 10000E+01 .155T41E+01 , ,104’’2E + 01 , . l''3206E + Ol

0270 DATA . 13089E+01 .3'73060E + 01 , .IS^GEE+Gl , 2''2242E + 06

0280 DATA . 18325E+01 3''3348E + 01 , .20944E+01 , -. l''320 3E + 01

0290 DATA . 23561E+01 -.100019E+01 , .26180E+01 , -. 5’’T342E + 00

0300 DATA . 28’’9'7E + 01 -.268049E+00 , .30000E+01 , 14254TE+00

0310 DATA . 31416E+01 .T34641E-05 , .34033E+O1 , . 26'’85lE + 00

0320 DATA . 36652E+01 . 5"''’362E + 00 , .392'’9E + 01 ,

. 10J182E + 01

0330 DATA . 41888E+01 ,1'73209E + 01 , .44505E+01 , . 3'’30'71E + 01

0340 DATA . 4''124E+01 -. 90'74"’3E+05 , .49'741E + 01 , 3‘’333‘7E + 01

0350 DATA . 50000E+O1 -.338052E+01 , .52360E+01 , 1^3200E+01

0360 DATA . 549’’ '£+01 10001'7E+01 , .5'7596E + U1 , -. 5'7''332E + 00

03'70 DATA . 60213E+01 -.268041E+00 , .62832E+01 , . 146928E-04

0380 DATA . 11000E+02 -.225951E+G3 , .25O0OE+02 , -. 133526E + 00

38
0390 DATA .75000E+02 , -.420701E+00 ,

. 1^000E+04 . 14"'032E + 01

0400 DATA .10000E+06 , -. 35'7'71te-01

0410 DIM E(53)

0420 LET L = 0 0430 LET H = 0 0440 LET M = 0 0450 LET V = 0 0460 PRINT "

"

, " ", " ", "RELATIVE"

04‘70 PRINT " ARGUMENT" , "TEST VALUE",

0480 FOR I = 1 TO 53

0485 LET SI = 1 0490 READ X,Y

0500 LET A$ = " " 0510 LET Z = TAN(X)

0511 IF ABS(Y) >= lE-38 THEN 518

0512 IF ABS (Z) LE-38 THEN 515

0513 LET E(I) = 0.0

0514 GO TO 590

0515 LET T1 = Y 0516 LET Y = Z

SYSTEM VALUE", ERROR"

0517 LET Z = T1

0518 REM TEST Y FOR SCALING

0519 IF ABS(Y) <= 1E30 THEN 521

0520 LET SI = lE-8

0521 IF ABS(Y) >= lE-30 THEN 523

0522 LET SI = 1E8

0523 LET E(I) = ((S1*Z) - (S 1 *Y ) ) / ( S 1 *Y ) 0524 LET E (I ) = ABS (E (I )

)

0525 LET A1 = E (I

)

0526 LET Y2 = Y 0527 GOSUB 9000

0528 IF ABS(Al) < C THEN 590

0580 LET A$ = "****" 0590 PRINT X,Y,Z,E (I) ;A$

0600 NEXT I 0610 PRINT

0620 PRINT " EVALUATION OF THE ABSOLUTE RELATIVE";

0630 PRINT " ERRORS"

0640 PRINT

0650 PRINT

0660 FOR I = 1 TO 53

0670 IF H > E (I ) THEN "'00 0680 LET H = E (I

)

0690 GO TO 720

0700 IF L <= E(I) THEN "720

0^7 10 LET L = E(I)

0720 NEXT I 0830 PRINT

0840 PRINT " LOWEST ERROR = ";L;" HIGHEST ERROR = ";H

0850 PRINT

0940 PRINT " END TEST"

0950 PRINT

0960 GO TO 9400

9000 IF 1 <= ABS(Y2) THEN 9101

9001 LET S2 = 1 9003 IF ABS(Y2) > lE-37 THEN 9010

9005 LET P = IE-3'7

39
9007 LET S2 = 1E10

9009 GO TO 9200

9010 LET P = 1 9020 LET PI = P/10

9030 IF PI <= ABS(Y2) THEN 9200

9040 LET P = P/10

9050 GO TO 9020

9101 LET S2 = 1 9105 IF ABS(Y2) <= 1E37 THEN 9110

9106 LET P = 1E38

9107 LET S2 = lE-10

9109 GO TO 9200

9110 LET P = 10

9120 IF ABS(Y2) < P THEN 9200

9130 LET P = P*10

9140 GO TO 9120

9200 LET Y1 = ABS (Y2)

9210 LET C = (.5E-6)*( (P*S2)/(Y1*S2)

)

9300 RETURN

9400 END

•k'k'k'k'kiciticititiciticicic'kit * SAMPLE OUTPUT *

icic-kicic'k-k’k-kitic'k-kitititit

PROGRAM FILE 105

SECTION 105.0

TANGENT FUNCTION (TAN)

BEGIN TEST

RELATIVE

ARGUMENT TEST VALUE SYSTEM VALUE ERROR

-10000 -. 320971 -. 320971 0 -100 . 587214 . 587214 0 -50 . 271901 . 2''1901 0 -16 -.300632 -. 300632 0 -8 6. '9971 6.79971 0 -4 -1.15782 -1.15^82 0 -2 2.18504 2.18504 0 -.5 -.546302 -. 546302 0 -. 1 -. 100335 -. 100335 0 -.001 -. 001 -. 001 0 -.00001 -. 00001 -. 00001 0 -1. 00000E-11 -1. 00000E-11 -1. 00000E-11 0 -1. 00000E-25 -1. 00000E-25 -1. 00000E-25 0

UO
0 0 0 0 1. 00000E-35 1. 00000E-35 1. 00000E-35 0 1. 00000E-16 1. 00000E-16 1. 00000E-16 0 1. 00000E-8 1. 00000E-8 1. 00000E-8 0

. 0001 . 0001 . 0001 0

. 01 1. 00003E-2 1. 00003E-2 0 .25 . 255342 . 255342 0

. 261'’9 . 26''939 . 26"7939 0

. 5236 . 577352 . 5^7352 0 .•75 . 931596 . 931596 0

. 78539 . 999984 . 999984 0

1 1. 55‘741 1. 55"'41 0 1.0472 1. 73206 1.73206 0 1.3089 3.7306 3.^306 0 1.5708 -272242 -2^2242 0 1.8325 -3. "73348 -3. "73348 0 2.0944 -1.73203 -1.73203 0 2.3561 -1.00019 -1.00019 0 2.618 -. 5''7342 -.57^342 0 2.8797 -.268049 -.268049 0

3 -. 14254-7 -.142547 0 3.1416 7. 34641E-6 34641E-6 0 3.4033 . 267851 . 267851 0 3.6652 . 57^362 . 57-7362 0 3.9279 1.00182 1.00182 0 4.1888 1.73209 1.73209 0 4.4505 3.73071 3.73071 0 4.7124 -90747.3 -90''47.

3

0 4.9741 -3. 7333"7 -3.73337 0

5 -3.38052 -3.38052 0 5.236 -1.732 -1.732 0 5.497'' -1.00017 -1.0001-7 0 5. •’596 -. 5^7332 -. 577332 0 6.0213 -.268041 -. 268041 0 6.2832 1. 46928E-5 1. 46928E-5 0 11 -225.951 -225. 951 0 25 -. 133526 -.133526 0 75 -. 420''01 -. 420-701 0 1000 1. 4"'032 1.47032 0 100000 -3. 5771''E-2 -3. 57717E-2 0 EVALUATION OF THE ABSOLUTE RELATIVE ERRORS

LOWEST ERROR = 0 HIGHEST ERROR = 0 END TEST

1)1
106.0 ACCURACY FOR E (PONENTIATION

Exponentiation has been used previously to test the operations and their

hierarchy. This test is aimed at assessing some of the accuracy

considerations relating to exponentiation. We have sampled 17 pairs of X, Y values covering some of the range of allowed values, and then we compute x"Y

to compare this against a test value. The program gives five columns of

output. The items generated are: the X argument, the Y exponent, the test

value, and the system generated-value. The last column gives the relative

error between the test and. system value. If the absolute relative error is

out of tolerance, then asterisks will appear next to the relative error,

indicating that there is loss of significance in the system result. Accuracy

beyond 6 significant digits is not tested in this program.

* PROGRAM FILE 106 *

if-k'kicicicit'kitkis^-kitic'k'kic'k-k

10 PRINT

20 PRINT

30 PRINT

40 PRINT

50 PRINT

60 PRINT

70 PRINT

80 PRINT

90 PRINT

100 PRINT

110 DATA

120 DATA

130 DATA

140 DATA

150 DATA

160 DATA

170 DATA

180 DATA

190 DATA

200 DATA

210 DATA

220 DATA

230 DATA

240 DATA

250 DATA

260 DATA

270 DATA

280 DIM E 290 LET L

300 LET H

"PROGRAM FILE 106”

1.0E38, 0.5, 1.0E19

1.0E38, -1, 1.0E-38

9.99999E18, 2, 9.99998E37

100, 7, 1.0E14

100, -1

,

1.0E-14

10, 24, 1.0E24

10, -24, 1.0E-24

2, 89, 6.1897E26

2, 66.6, 1.1184E20

2, 16, 65536

2, -44.3, 4.61712E-14

1.0001, 100, 1.01005

1 , 88 , 1

1 , - 1 , 1 0.9999, 11.111, 0.992252

1.73715E-11, 3, 5.24218E-33

1.0E-38, 0.5, 1.0E-19

(17)

= 0 = 0

SECTION 106.0"

EXPONENTIATION"

X^Y"

BEGIN TEST"

Ii2
31t) PRINT " ", " ", " ", " ", "RELATIVE"

320 PRINT "X", "Y", "TEST VALUE", "SYSTEM VALUE", "ERROR"

330 FOR I = 1 TO 17

335 LET SI = 1 340 READ X, Y, T

350 LET A$ = " " 360 LET Z = X''Y 370 IF T >= lE-38 THEN 395

375 IF Z >= lE-38 THEN 392

380 LET E (I ) = 0.0

390 GO TO 450

392 LET T1 = T

393 LET T = Z 394 LET Z = T1

395 REM TEST T FOR SCALING

396 IF ABS(T) <= 1E30 THEN 398

397 LET SI = lE-8

398 IF ABS(T) >= lE-30 THEN 400

399 LET SI = 1E8

400 LET E(I) = ((S1*Z) - (S1*T) )/(Sl*T)

410 LET E (I ) = ABS (E (I )

)

420 LET A1 = E (I

)

421 LET Y2 = T

422 GOSUB 9000

430 IF ABS(Al) < C THEN 450

440 LET A$ = "****"

450 PRINT X, Y, T, Z, E(I); A$

460 NEXT I 470 PRINT

480 PRINT " ABSOLUTE RELATIVE ERROR RANGE

490 PRINT

500 PRINT

660 FOR I = 1 TO 17

670 IF H > E(I) THEN 700

680 LET H = E (I

)

690 GO TO 720

700 IF L <= E (I

)

THEN 720

710 LET L = E (I)

7 20 NEXT I 730 PRINT

740 PRINT " LOWEST ERROR = "; L ; " HIGHEST ERROR

7 50 PRINT

810 PRINT " END TEST"

850 GO TO 9400

9000 IF 1 <= ABS(Y2) THEN 9101

9001 LET S2 = 1 9003 IF ABS(Y2) > lE-37 THEN 9010

9005 LET P = IE-3'7

9007 LET S2 = 1E10

9009 GO TO 9200

9010 LET P = 1 9020 LET PI = P/10

9030 IF PI <= ABS(Y2) THEN 9200

9040 LET P = P/10

9050 GO TO 9020

9101 LET S2 = 1 9105 IF ABS(Y2) <= 1E3'' THEN 9110

43
9106 LET P = 1E38

9107 LET S2 = lE-10

9109 GO TO 9200

9110 LET P = 10

9120 IF ABS(Y2) < P THEN 9200

9130 LET P = P*10

9140 GO TO 9120

9200 LET Y1 = ABS (Y2)

9210 LET C = (. 5E-6) * ( (P*S2) /{Y1*S2)

)

9300 RETURN

9400 END

ic-k-kitieisiticit-kif-k-kisif-k-k * SAMPLE OUTPUT * *****************

PROGRAM PILE 106

SECTION 106.0

EXPONENTIATION

X"Y

BEGIN TEST

RELATIVE

X Y , TEST VALUE SYSTEM VALUE ERROR

1. 00000E+38 . 5 1'. 00000E + 19 1 . 00000E+19 0 1. 00000E+38 -1 1. 00000E-38 1. 00000E-38 0 9. 99999E+18 2 9. 99998E +

3'’ 9. 99998E+37 0 100 7 1 . 00000E+14 1. 00000E+14 0 100 -7 1. 00000E-14 1. 00000E-14 0 10 24 1. 00000E+24 1. 00000E+24 0 10 -24 1. 00000E-24 1. 00000E-24 0 2 89 6. 189'70E + 26 6. 189'70E + 26 0

2 66.6 1. 11840E+20 1. 11840E+20 0 2 16 65536 65536 0

2 -44. 3 4. 61’’12E-14 4. 61-712E-14 0 1.0001 100 1.01005 1.01005 0 1 88 1 1 0

1 -1 1 ] 0

. 9999 'll . Ill . 992252 . 992252 0 1. 73'715E-11 3 5. 24218E-33 5. 24218E-33 0 1. 00000E-38 0.5 1. 00000E-19 1. 00000E-19 0 RELATIVE

1

| 1|

ABSOLUTE ERROR RANGE
LOWEST ERROR 0 HIGHEST ERROR 0 END TEST

1

i;

1 :
107.0 EXCEPTION TEST FOR TAN FUNCTION AT PI/2

This routine tests fo

overflow occurs, it shou

8.5 of BSR X3.60). P the left by 5 pairs of po

precision. With infinite

approaches, the TAN funct

the right approach pi/2 th

given finite precision

evaluation of the tangent

after some point. If ther

program suspended. But fr

is highly unlikely to ex termination.

r overflow of the tangent function near Pi/2. If

Id be reported, and program terminated (see section

i/2, in the program, is approached on the right and

ints, each pair having 6, , 8, 14 and 56 digits of

precision, as the point to the left of pi/2

ion approaches positive infinity. As the points to

e TAN function approaches negative infinity. But,

and roundoff considerations the user should see the

function give the same value for all arguments

e is an overflow then it should be reported and the om the present precision available on machines it

perience overflow and the program should proceed to

M'k'k'k'k-k-k-k'k'k'k'kifii-k'k-k'kic'k * PROGRAM FILE 107 *

10

20

30

40

50

60

70

335

340

345

350

355

360

365

370

3'75 380

385

390

395

400

405

410

415

420

425

430

435

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

REM

LET

LET

REM

LET

LET

REM

LET

LET

REM

LET

LET

REM

LET

LET

LET

LET

PRINT

PRINT

PRINT

PRINT

PROGRAM FILE 10''"

" SECTION 107.0: EXCEPTION TEST FOR TAN NEAR PI/2"

•• BEGIN TEST"

6 DIGIT ARGUMENTS SURROUNDING PI/2

XI = TAN (1. 5''080)

Y1 = TAN (1 . 5''079)

DIGIT ARGUMENTS SURROUNDING Pl/2

X2 = TAN (1. 570''97)

Y2 = TAN (1. 570796)

8 DIGIT ARGUMENTS SURROUNDING PI/2

X3 = TAN (1. 5''0''964)

Y3 = TAN (1 . 5707963

)

14 DIGIT ARGUMENTS SURROUNDING Pl/2

X4 = TAN (1. 5''0''963267949)

Y4 = TAN (1. 5''0^96326''948)

56 DIGIT ARGUMENTS SURROUNDING Pl/2

X5 = 1. 570''96326^9489661923132169163975144209858469968''56

Y5 = 1. 5''079632679489661923132169163975144209858469968''55

X5 = TAN(X5)

Y5 = TAN (Y5)

THIS ROUTINE ATTEMPTS TO FORCE AN OVERFLOW FOR THE"

TAN FUNCTION NEAR PI/2."

FIVE PAIRS OF CONSTANTS ARE USED AS ARGUMENTS"

EACH PAIR BRACKETS PI/2 WITHOUT REGARD TO ROUNDING"
440

445

450

455

456

459

460

465

470

475

480

485

490

491

495

496

500

510

515

PRINT "THE FIVE PAIRS HAVE 6, 7, 8, 14, AND 56 DIGITS RESPECTIVELY"

PRINT "ASSUMING INFINITE PRECISION CAPABILITY COLUMN 1 BELOW"

PRINT "SHOULD TEND TO + INFINITY AND COLUMN 2 TO - INFINITY"

PRINT "FINITE PRECISION ARITHMETIC AND ROUNDOFF WII.L GENERATE THE"

PRINT "SAME NUMBER IN BOTH COLUMNS AT SOME POINT"

PRINT

PRINT Yl, XI

PRINT Y2, X2

PRINT Y3, X3

PRINT Y4, X4

PRINT Y5, X5

PRINT

PRINT "IF OVERFLOW OCCURRED ABOVE THEN IT SHOULD HAVE BEEN"

PRINT "REPORTED AND PROGRAM TERMINATED. IF NOT THEN IT IS"

PRINT "UNLIKELY THAT TAN FUNCTION WILL OVERFLOW FOR ANY"

PRINT "CALCULATION."

PRINT

PRINT " END TEST"

END

* SAMPLE OUTPUT *

•k'hif'k'kicic'kiiic’kit-k'k-k-k'k

PROGRAM FILE 107

SECTION 10'7.0: EXCEPTION TEST FOR 'I'AN NEAR PI/2

BEGIN TEST

THIS ROUTINE ATTEMPTS TO FORCE AN OVERFLOW FOR THE

TAN FUNCTION NEAR PI/2.

FIVE PAIRS OF CONSTANTS ARE USED AS ARGUMENTS

EACH PAIR BRACKETS PI/2 WITHOUT REGARD TO ROUNDING

THE FIVE PAIRS HAVE 6, 7, 8, 14, AND 56 DIGITS RESPECTIVELY

ASSUMING INFINITE PRECISION CAPABILITY COLUMN 1 BELOW

SHOULD TEND TO + INFINITY AND COLUMN 2 TO - INFINITY

FINITE PRECISION ARITHMETIC AND ROUNDOFF WILL GENERATE THE

SAME NUMBER IN BOTH COLUMNS AT SOME POINT

157649

3, 05163E+6

2, 84819E+'7

2. 84819E+^

2. 84819E+"'

-272120

-1. 47320E + 6 -1. 42409E +

'' 2. 84819E+7

2. 84819E+7

IF OVERFLOW OCCURRED ABOVE THEN IT SHOULD HAVE BEEN

REPORTED AND PROGRAM TERMINATED. IF NOT THEN IT IS

47
UNLIKELY THAT TAN FUNCTION WILL OVERFLOW FOR ANY

CALCULATION.

END TEST
108.0 RND FUNCTION WITHOUT RANDOMIZH

The objective of this test is to verify that: the i iiipi emen tra t i on-suppl i ed

RND function will generate the same sequence of pseudo-r andom numbers each

time a program is run (see section 8 of BSR X3.60). The test program

below generates 20 random numbers using the RND function without the

RANDOMIZE statement. In order to test that the same sequence of 20 random

numbers is regenerated the user should repeat the program several (3 oi 4)

times. On output, there is a printed message informing the user that 20

random numbers follow the message. After these numbers are printed, another

message should inform the user that the same 20 random numbers should occur

for each execution of the program. The sample output below only gives ttie

result of two sample executions. The main point of the test is that the

sequence of 20 numbers is the same in each execution, and that each number is

nonzero, and less than one.

ick'k-k'k'kkk’k'kiiiititkic-k-k-kk’k * PROGRAM FILE 108 * •kkk-kkk'kk-kkk-k'kkk'kk'kick

0010 PRINT "PROGRAM FILE 108"

0060 PRINT

00'70 PRINT

0080 PRINT

0085 PRINT "SECTION 108.0: RND FUNCTION WITHOUT RANDOMIZE STATEMENT"

0190 PRINT

0200 DIM A(20)

0210 FOR 1=1 TO 20

0220 LET A ( I

) =RND

0230 NEXT I 0240 PRINT " THE FOLLOWING 20 NUMBERS SHOULD BE THE IMPLEMENTATION-"

0250 PRINT "PREDEFINED SEQUENCE OF PSEUDO-RANDOM NUMBERS OF THIS SYSTEM"

0260 PRINT "AS VALUES FOR ITS RND FUNCTION."

0270 PRINT

0280 FOR 1=1 TO 20

0290 PRINT TAB(33);A(I)

0300 NEXT I 0310 PRINT

0320 PRINT " THE ABOVE SEQUENCE OF PSEUDO-RANDOM NUMBERS SHOULD BE"

0330 PRINT "THE SAME FOR EACH PROGRAM EXECUTION,"

0340 END

k'kkkkkk'kkkkkiik-kkk

* SAMPLE OUTPUT *

ii9
PROGRAM FILE 108

SECTION 108.0: RND FUNCTION WITHOUT RANDOMIZE STATEMENT

THE FOLLOWING 20 NUMBERS SHOULD BE THE IMPLEMENTATIONPREDEFINED SEQUENCE OF PSEUDO-RANDOM NUMBERS OF THIS SYSTEM

AS VALUES FOR ITS RND FUNCTION.

. 21

'78''3

. 696209

. 29'751

. 963'?94

. 463246

. 76''^46

. 18166^

. 159454

6. 52568E-2

. 495683

. 644913

. 92'7201

. 6-7T35

. 80436"7

. 992458

2. 75721E-2

. 322263

. •’31568

. 704922

. 12663

THE ABOVE SEQUENCE OF PSEUDO-RANDOM

THE SAME FOR EACH PROGRAM EXECUTION.

NUMBERS SHOULD BE

PROGRAM FILE 108

SECTION 108.0: RND FUNCTION WITHOUT RANDOMIZE STATEMENT

THE FOLLOWING 20 NUMBERS SHOULD BE THE IMPLEMENTATIONPREDEFINED SEQUENCE OF PSEUDO-RANDOM NUMBERS OF THIS SYSTEM

AS VALUES FOR ITS RND FUNCTION.

. 2178‘’3

. 696209

. 29'’51

50
. 963'794

.463246

.

•76 '7^46

. 18166''

. 159454

6. 52568E-2

. 495683

. 644913

. 927201

. 6

-7 '35

. 80436''

. 992458

2. 75''2lE-2

. 322263

.731568

. 704922

. 12663

THE ABOVE SEQUENCE OF PSEUDO-RANDOM NUMBERS SHOULD BE

THE SAME FOR EACH PROGRAM EXECUTION.

51
109.0 RND FUNCTION WITH RANDOMIZE

I The objective of this test is to verify that the RANDOMIZE-statement j overrides the implementation-predefined sequence of pseudo-random numbers as

' values for the RND function (see section 17 of BSR X3.60). This allows

different (and unpredictable) sequences each time a given program is ! executed. In order to test that a different sequence occurs each time the i program is executed this program should be run several (3 or 4) times. On

' output, a message should tell the user that 20 random numbers should follow

the message. After the numbers have been generated, another message should ! indicate that each execution of the program should generate a different set

' of 20 unpredictable random numbers. Only the results of two executions will ; be given below.

•kit-k’k'k'k-k'k-kicicicicicieicitieicic * PROGRAM FILE 109 *

’k’kic'kicicif'kit-kiciciciticicicitit'k

0010 PRINT "PROGRAM FILE 109"

0060 PRINT

0070 PRINT ; 0080 PRINT ' 0090 PRINT " SECTION 109.0"

0100 PRINT

0110 PRINT " (RND FUNCTION WITH THE RANDOMIZE STATEMENT.)"

0150 DIM A(20)

0160 RANDOMIZE

0170 FOR 1=1 TO 20

0180 LET A (I ) =RND

0190 NEXT I 0200 PRINT " THE FOLLOWING SEOUENCE OF 20 NUMBERS SHOULD BE AN OVER"

0210 PRINT "RIDE OF THE IMPLEMENTATION-PREDEFINED SEQUENCE OF PSEUDO-" j 0220 PRINT "RANDOM NUMBERS OF THIS SYSTEM AS VALUES FOR ITS RND FUNC-"

0230 PRINT "TION."

0240 PRINT

0250 FOR 1=1 TO 20

0260 PRINT TAB(33);A(I)

0270 NEXT I 0280 PRINT

0290 PRINT " THE ABOVE SEQUENCE SHOULD BE DIFFERENT (AND UNPREDICT-"

0300 PRINT "ABLE FOR EACH PROGRAM EXECUTION."

0310 END

•kif'kic'kicicicitififit'kic'kif-k

52

^4
* SAMPLE OUTPUT *

'k’kic'k’kic'kif-k-k-kicic-k'kii-k

PROGRAM FILE 109

SECTION 109.0

(RND FUNCTION WITH THE RANDOMIZE STATEMENT.)

THE FOLLOWING SEQUENCE OF 20 NUMBERS SHOULD BE AN OVER

RIDE OF THE IMPLEMENTATION-PREDEFINED SEQUENCE OF PSEUDORANDOM NUMBERS OF THIS SYSTEM AS VALUES FOR ITS RND FUNCTION.

. 49927

. 723266

. 8"’6503

. 286454

. •’61588

. 250402

. 785"'24

. 484855

. 126906

. 707897

. 547312

. 735257

. 493621

3. 21666E-2

. 862163

. 12934

4. 09330E-2

. 767423

. 622961

7 . 30995E-2

THE ABOVE SEQUENCE SHOULD BE DIFFERENT (AND UNPREDICTABLE FOR EACH PROGRAM EXECUTION.

PROGRAM FILE 109

SECTION 109.0

(RND FUNCTION WITH THE RANDOMIZE STATEMENT.)

THE FOLLOWING SEQUENCE OF 20 NUMBERS SHOULD BE AN OVER

RIDE OF THE IMPLEMENTATION-PREDEFINED SEQUENCE OF PSEUDORANDOM NUMBERS OF THIS SYSTEM AS VALUES FOR ITS RND FUNC53
TION

. 690698

. 228783

. 618376

. 764632

. 790845

3. 87759E-2

.455331

1.96282E-2

. 657152

.458736

.246176

5.84041E-2

. 914067

. 265804

. 715556

. 152839

. 160243

. 324208

6. 69062E-2

. 426047

THE ABOVE SEQUENCE SHOULD BE DIFFERENT (AND UNPREDICTABLE FOR EACH PROGRAM EXECUTION.
I

110. fe) UNIFORMITY TEST FOR THE RND FUNCTION

The RND function generates the next pseudo-random number in and

implementation-supplied sequence of pseudo-random numbers uniformly

distributed from 0 to 1 (see section 8 of BSR X3.60). The uniformity of

the distribution of the numbers is a statistically measurable quantity. This

is the objective of the following test program, in which two statistical

"goodness-of-f it" tests are performed. In general goodness of fit tests are used to determine whether an assumed population distribution is consistent

with data available. The hypothesis we wish to test is whether the

population density is given by the uniform density.

We first test the local behavior of the random number generator by

performing 30 statistical experiments. Each experiment consists of sampling

2000 random numbers from the unit interval. Since the RANDOMIZE statement is

used each sequence begins with a different seed number for the random nmber

generator. We test the uniformity of each sequence by using a chi-square

test

.

To compute the chi-square value we first divide the unit interval into k subintervals (in our case k=21). If the subintervals are of the same length

then the probability of a uniform random number falling into a subinterval is

1/k. We note that there is a rule of thumb for selecting the number of equal

subintervals. That is that if n is the sample size (in our case n = 2000)

and k is the number of subintervals then we must choose n and k so that n/k

>= 5. In our case this is easily satisfied so that our coice of the number

of subintervals was satisfactory. The number n/k is the expected frequency

of uniform numbers per subinterval. In our test this is approximately 95 per

subinterval

.

Once the frequency count per subinterval has been computed tne

chi-square value for each experiment can computed and this value compared

against a table of chi-square values with k-1 degrees of freedom (see, for

example Handbook of Mathemat ical Functions , ed. by M. Abomowitz and I. A,

Stegun, U.S. Government Printing Office, 1964, Table 26.8), In our case we have 20 degrees of freedom. For each experiment if the chi-square value is

less than the 99-percent entry or greater than the 1-percent entry we reject

the experiment as not sufficiently random. If the chi-square value lies

between the 99 and 95-percent entries or between the 5 and 1-percent entries

the numbers are suspect. Finally, if the chi-square lies between tiie 95 and

90-percent entries or 10 and 5 percent entries the sequence is considered

almost suspect. If the chi-square value is any other number, the hypothesis

is accepted that the underlying distribution is uniform locally.

After the 30 chi-square values have been generated these numbers

themselves can be tested against the chi-square distribution. This is done

by the Kolmogorov-Smir nov test. The output of this test is a set of two

numbers. Each must lie within the acceptable range in order for ttie test to

have been successful. The techniques involved are discussed in D, E. Knuth, The Ar t of Computer Programming , Vol. 2, Add i son-Wesley Publishing

Company, Reading, Massachusetts (1969). The chi-square cumulative

distribution function computed in lines 4900 to 5800 in the program is

computed directly from the integral definition using the fact that for an even degree of freedom one can use a table of integrals to determine the

iteration formula in line 5680. For example, the user might consult C . R.

C

Standard Mathematical Tables , Thirteenth Edition, Ed. Robert C. Weast , The

1 55
Chemical Rubber Co., Cleveland (1964), p 317, Formula 354.

'k’k'k-k'k'kicifif'kiikic'kM'k'k-kicic * PROGRAM FILE 110 *

'k'kic’k'k'k'k'k'k'k'k'k'k’kificic'k-k'k

2 PRINT "PROGRAM FILE 110"

5 PRINT

6 PRINT

7 PRINT

10 PRINT " SECTION 110.0: UNIFORMITY 'VEST FO THE RND FUNCTION

15 PRINT

20 PRINT " BEGIN TEST"

30 PRINT

50 DIM Y (21) ,V (30) ,F (30)

100 PRINT "EXPERIMENT", "CHI-SQUARE", "EVALUATION"

110 PRINT

150 REM PERFORM 30 EXPERIMENTS OF 2000 SAMPLES EACH

200 REM OF PSEUDO-RANDOM NUMBERS THEN COMPUTE

250 REM AND TEST CHI-SQ STATISTIC FOR EACH EXPERIMENT

350 LET R1 = 0 400 LET SI = 0 450 LET S2 = 0 500 LET A =0

550 FOR E = 1 TO 30

600 RANDOMIZE

650 REM INITIALIZE OBSERVED COUNTS AT 0 FUK A PARTITION OF THE

700 REM UNIT INTERVAL INTO 21 CELLS

800 FOR I = 1 TO 21

850 LET Y(I) = 0 900 NEXT I 950 REM OBTAIN FREQUENCY COUNTS FOR 2000 RANDOM NUMBERS

1050 FOR I = 1 TO 2000

1100 LET X = RND

1150 LET R = INT(21*X) + 1 1200 LET Y (R) = Y (R) + 1 1250 NEXT I 1300 REM COMPUTE CHI-SQ STATISTIC FOR EACH EXPERIMENT

1400 LET V(E) = 0 1450 LET S = 0 1500 FOR I = 1 TO 21

1550 LET S = S + (21*Y (I ) *Y (I )

)

1600 NEXT I 1650 LET V(E) = (1/2000)*S - 2000

1700 REM TEST CHI-SQ STATISTIC FOR EACH EXPERIMENT

1800 IF V(E) >= 8.260 THEN 2000

1850 LET R1 = R1 + 1 1900 LET F$ = "REJECT"

1950 GO TO 3150

5b
2000

2050

2100

2150

2200

2250

2300

2350

2400

2450

2500

2550

2600

2650

2700

2750

2800

2850

2900

2950

3000

3050

3100

3150

3200

3250

3300

3350

3400

3450

3500

3550

3600

3650

3660

3700

3750

3760

3770

3900

3950

4000

4050

4100

4150

4200

4250

4300

4350

4400

4450

4500

4600

4700

4750

4800

4900

IF V(E) >= 10.85 THEN 2200

LET SI = SI + 1 LET F$ = "SUSPECT"

GO TO 3150

IF V(E) >= 12.44 THEN 2400

LET S2 = S2 + 1 LET F$ = "ALMOST SUSPECT"

GO TO 3150

IF V(E) > 28.41 THEN 2600

LET A = A + 1 LET F$ = "ACCEPT"

GO TO 3150

IF V(E) >31.41 THEN 2800

LET S2 = S2 + 1 LET F$ = "ALMOST SUSPECT"

GO TO 3150

IF V(E) > 37.57 THEN 3000

LET SI = SI + 1 LET F$ = "SUSPECT"

GO TO 3150

LET F$ = "REJECT"

LET Rl = Rl + 1 REM PRINT EVALUATION

PRINT E, V(E) , F$

NEXT E PRINT

PRINT "SUMMARY EVALUATION STATISTICS"

PRINT

PRINT "NUMBER OF REJECTS = ";Rl

PRINT "NUMBER OF SUSPECTS = ";S1

PRINT "NUMBER OF ALMOST SUSPECTS = ";S2

PRINT "NUMBER OF ACCEPTS = ";A

PRINT

PRINT "THE GENERATOR SHOWS POOR LOCAL RANDOMNESS IF THERE"

PRINT "ARE ANY REJECTS."

PRINT "IF THE NUMBER OF ACCEPTS DOES NOT OUTWEIGH THE OTHER"

PRINT "CATEGORIES THEN THIS SYSTEM IS USING A POOR RND FUNCTION"

PRINT "BUT FINAL REJECTION DEPENDS ON THE RESULTS OF THE"

PRINT "FINAL STATISTICS FOR UNIFORMITY."

REM COMPUTING KOLMOGOROV-SMIRNOV STATISTIC TO TEST GLOBAL

REM UNIFORMITY OF THE PSEUDO-RANDOM NUMBER GENERATOR

REM SORT CHI-SQ VALUES V(E)

LET Z = 0 FOR I = 1 TO 29

IF V{I) <= V(I+1) THEN 4400

LET Q = V(I)

LET V(I) = V(I+1)

LET V(I+1) = Q

LET Z = 1 NEXT I IF Z > 0.5 THEN 4050

REM COMPUTE TWO KOLMOGOROV- SMIRNOV STATISTICS K+ AND K-.

REM CALL K+ BY K1 AND K- BY K2. BEGIN BY COMPUTING THE

REM PROBABILITIES FOR V (1 )

, . . . , V (30

)

FROM THE CUMULATIVE

REM OF THE CHI-SQ DISTRIBUTION. THIS IS DONE BELOW FOR THE

REM CASE OF AN EVEN DEGREE OF FREEDOM N.

LET N = 20

57
4950 LET M = N/2

5000 LET K = M - 1 5010 REM COMPUTING GAMMA FUNCTION OF M OR (M-1 ) -FACTORIAL.

5050 LET FI = 1 5100 IF K = 0 THEN 5300

5150 FOR I = 1 TO K

5200 LET FI = I * FI

5250 NEXT I 5260 REM NORMALIZING COEFFICIENT

5300 LET C = l/( (2M) *F1)

5350 REM COMPUTING INTEGRAL ITERATIVELY

5400 FOR I = 1 TO 30

5450 LET X2 = V(I)

5500 LET II = 2 * (1 - EXP (-0; 5*X2)

)

5550 IF K = 0 THEN 5750

5600 FOR J = 1 TO K 5650 LET II = 2*J*I1 - 2* (X2J) *EXP (-0. 5*X2)

5700 NEXT J

5750 LET F{I) = C * II

5800 NEXT I 5900 REM LET Ml = MAX OF J/30 - F(J) FOR J = 1 TO 30 AND M2

5950 REM MAX OF F(J) - J/30 FOR J = 1 TO 30. COMPUTE K+ = K1

6050 REM SQR(30)*M1 AND K- = K2 = SQR(30)*M2

6150 LET Ml = (1/30) - F{1)

6200 LET M2 = F(l)

6250 FOR J = 2 TO 30

6300 IF Ml >= (J/30) - F(J) THEN 6400

6350 LET Ml = (J/30) - F(J)

6400 IF M2 >= F(J) - ((J-l)/30) THEN 6500

6450 LET M2 = F(J) - ((J-l)/30)

6500 NEXT J

6550 LET K1 = SQR(30) * Ml

6600 LET K2 = SQR(30) * M2

6650 REM TEST KOLMOGOROV-SMIRNOV STATISTIC

6750 PRINT

6800 PRINT "KOLMOGOROV-SMIRNOV STATISTIC TEST FOR UNIFORMITY

6850 PRINT

6860 LET Q$ = " " 6900 IF K1 >= 0.04354 THEN 7050

6950 LET Q$ = "REJECT"

7000 GO TO 7550

7050 IF K1 >= 0.1351 THEN '’200

7100 LET Q$ = "SUSPECT"

7150 GO TO 7550

7200 IF K1 > 1.916 THEN 7350

7250 LET Q$ = "ACCEPT"

7300 GO TO 7550

7350 IF K1 > 1.4801 THEN 7500

7400 LET Q$ = "SUSPECT"

7450 GO TO 7550

7500 LET Q$ = "REJECT"

7550 PRINT "K+ = "; Kl, Q?

7560 LET Q$ = " " 7600 IP K2 >= 0.04354 THEN '^750

7650 LET Q$ = "REJECT"

7700 GO TO 8250

7750 IF K2 >= 0.1351 THEN 7900

58
7800 LET Q$ = "SUSPECT"

7850 GO TO 8250

7900 IF K2 >1.916 THEN 8050

7950 LET Q$ = "ACCEPT"

8000 GO TO 8250

8050 IF K2 > 1.4801 THEN 8200

8100 LET Q$ = "SUSPECT"

8150 GO TO 8250

8200 LET Q$ = "REJECT"

8250 PRINT "K- = "; K2, Q$

8300 PRINT

8350 PRINT "IF EITHER STATISTIC IS LESS THAN ACCEPTABLE,"

8400 PRINT "THIS INDICATES GLOBAL NONRANDOMNESS."

8500 PRINT

8600 PRINT " END TEST"

9000 END

k-k* it -k-k-k-k-kii-kic-ickli-k-k * SAMPLE OUTPUT * kkkkkkkkkkkkkkkkk

PROGRAM FILE 110

SECTION 110.0: UNIFORMITY TEST FOR THE RND FUNCTION

BEGIN TEST

EXPERIMENT CHI-SQUARE EVALUATION

1 19.801 ACCEPT

2 10.372 SUSPECT

3 12. 15‘7 ALMOST SUSPECT

4 22. 657 ACCEPT

5 10.624 SUSPECT

6 10. 246 SUSPECT

7 16. 504 ACCEPT

8 22. 72 ACCEPT

9 14.656 ACCEPT

10 14.593 ACCEPT

11 18.919 ACCEPT

12 22. 678 ACCEPT

13 10.939 ALMOST SUSPECT

14 30. 259 ALMOST SUSPECT

15 30. 259 ALMOST SUSPECT

16 15.139 ACCEPT

17 17.806 ACCEPT

18 16.315 ACCEPT

59
19 7. -76801 REJECT

20 1^.617 ACCEPT

21 24.211 ACCEPT

22 20.053 ACCEPT

23 18. 94 ACCEPT

24 32.653 SUSPECT

25 49.894 REJECT

26 19.885 ACCEPT

27 19.717 ACCEPT

28 9.658 SUSPECT

29 25. 765 ACCEPT

30 8.79701 SUSPECT

SUMMARY EVALUATION STATISTICS

NUMBER OF REJECTS = 2 NUMBER OF SUSPECTS = 6 NUMBER OF ALMOST SUSPECTS = 4 NUMBER OF ACCEPTS = 18

THE GENERATOR SHOWS POOR LOCAL RANDOMNESS IF THERE

ARE ANY REJECTS.

IF THE NUMBER OF ACCEPTS DOES NOT OUTWEIGH THE OTHER

CATEGORIES THEN THIS SYSTEM IS USING A POOR RND FUNCTION

BUT FINAL REJECTION DEPENDS ON THE RESULTS OF THE

FINAL STATISTICS FOR UNIFORMITY.

KOLMOGOROV-SMIRNOV STATISTIC TEST FOR UNIFORMITY

K+ = .992047 ACCEPT

K- = .370091 ACCEPT

IF EITHER STATISTIC IS LESS THAN ACCEPTABLE,

THIS INDICATES GLOBAL NONRANDOMNESS.

END TEST

60
111.0

USER DEFINED FUNCTIONS WITH A PARAMETER LIST

The next two sections test whether the implementation allows

user-defined functions. They furthermore verify the forms that such

functions can take. The reader is referred to section 16 of BSR X3.60.

The objective of this first section is to test the basic forms a definition

can take when the defining function uses a parameter-list as follows;

DEF FNx (parameter ) =expression

where x is a single letter and a parameter is a simple-numeric- variable.

111.1

Defining Expression Uses Only the Parameter

The primary objective of this subtest is to verify that the parameter in

the parameter-list can be used by itself to form the expression needed in

defining the function. That is, we test that the implementation allows the

following form of a statement for defining a function:

DEF FNA(X)=X*^X

where X is a the parameter in the parameter-list. A secondary objective is

to test some of the forms an expression can have when introduced into the

parameter list at the time of a function reference. In particular the

expression in the argument list for the function references that are being

tested are: (1) a constant, (2) a simple numeric variable, (3) a simple

expression of two or more terms, and (4) an expression consisting of another

function reference. On output, the test informs the user of any evaluation

failure by the implementation. For each failure a message is supplied

indicating the nature of the failure.

111.2

The Defining Expression Uses Other Parameters

The objective of this subtest is to verify that both the parameter in

the parameter-list and other variable (s) can be used to form the expression

needed in defining the function. That is, we test whether the implementation

allows the following form of a statement in defining a function;

DEF FNA(X)=A*X+B

where X is the parameter in the parameter-list. On output, there should be a message indicating whether the implementation passed or failed the test.

111.3

The Defining Expression Uses Constants

The objective of this subtest is to verify that both the parameter in

the parameter-list and constants can be used to form the expression used to

define the function. In particular, we test whether the implementation

allows the following form of a statement for defining a function:

DEF FNA (X) =X''4-1

where X is the parameter in the par ameter -1 ist . On output, there should be a

6l
message indicating whether the implementation passed or failed the test.

111.4 The Defining Expression References Another Defined Function

The objective of this subtest is to verify that a preceding definition

can be used in a succeeding definition (i.e., a definition in a lower line

number should be allowed in another definition if the latter is in a higher

line number). This test also verifies that the parameter appearing in the

parameter-list of a function definition is local to that definition (i.e., it

is distinct from any variable with the same name outside of the function

definition. However the variables in the defining expression that do not

appear in the parameter-list are the variables of the same name outside the

function definition). The program below verifies that the implementation

will properly evaluate several definitions in the same program as follows:

DEF FNA (Z) =Z'‘2-4

DEF FNB (Z) =Z*X+FNA (A''2+B)

where Z is the parameter for both parameter-1 i sts . On output, there should

be a message indicating whether the implementation passed or failed the test.

•kit'k'kicicicic'kif'kititifificif'k'kit * PROGRAM FILE 111 *

‘kiticic'kit'k'kiric-kleic'kiticitif-k-k

0010

0020

0030

0040

0050

0090

0100

0110

0120

0130

0140

0150

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

"PROGRAM FILE 111"

SECTION 111.0."

TESTING USER-DEFINED FUNCTIONS WITH PARAMETER LISTS"

n*****MOTE: THIS UNIT IS ALSO A PRELIMINARY INTRODUCTION TO"

"FUNCTIONS OF EXPRESSIONS. MORE EXTENSIVE CASES WILL OCCUR"

"IN A LATER UNIT.*****"

" SECTION 111-1"

"(THE EXPRESSION OF THE DEFINITION USING ONLY THE PARAMENTEK"

" OF THE PARAMENTER-LIST. )

BEGIN TEST,

62
0310 DEF FNA {X) =X*X

0320 DEF FNB (Y) =Y*Y*Y

0330 LET A = 5 0340 LET B=4

0350 LET C = 3 0360 LET E = 0 0370 LET X=FNA(12)

0380 LET Y=FNA(A)

0390 LET Z=FNA (2*A"3+4*B+C)

0400 LET W=FNA(FNB (2) +B''3)

0410 LET F = 1 0420 IF X=144 THEN 440

0430 GOSUB 540

0440 LET F=2

0450 IF y=25 THEN 470

0460 GOSUB 540

04'70 LET F = 3 0480 IF Z=72361 THEN 500

0490 GOSUB 540

0500 LET F=4

0510 IF W=5184 THEN 680

0520 GOSUB 540

0530 GOTO 680

0540 LET E=1

0550 ON F GOTO 560,580,600,620

0560 LET A$=”A CONSTANT"

0570 GOTO 630

0580 LET A$="A VARIABLE"

0590 GOTO 630

0600 LET A$="CONS. AND VARS."

0610 GOTO 630

0620 LET A$="OTHER DEF FNX USED"

0630 PRINT "SYSTEM FAILED TO EXECUTE PROPERLY WHEN THE EXPRESSION"

0640 PRINT "IN THE ARGUMENT-LIST FOR THE FUNCTION REFERENCE WAS"

0650 PRINT A$;"."

0660 PRINT

0670 RETURN

0680 IF E=0 THEN 710

0690 PRINT "SYSTEM FAILED TEST, NOTE THE ABOVE REASONS."

0700 GOTO 720

0710 PRINT "SYSTEM PASSED TEST."

0720 PRINT

0730 PRINT

0740 PRINT

1060 PRINT

1070 PRINT

1080 PRINT

1090 PRINT

1100 PRINT

1110 PRINT

1120 PRINT

1130 PRINT

1140 PRINT

1150 PRINT " 1160 PRINT

1170 DEF FNC (A) =A*A-B+C

1180 LET B=-15

END TEST.

SECTION 111.2"

(THE EXPRESSION OF THE DEFINITION USING THE PARAMETER OF"

THE PARAMENTER-LIST AND OTHER VARIABLES.)"

BEGIN TEST."

63
1190 LET C=-35

1200 LET X=FNC{13)

1210 IF X=149 THEN 1240

1220 PRINT "SYSTEM FAILED TEST."

1230 GOTO 1250

1240 PRINT "SYSTEM PASSED TEST."

1250 PRINT

1260 PRINT " END TEST.

1270 PRINT

2060 PRINT

2070 PRINT

2080 PRINT

2090 PRINT " SECTION 111.3"

2100 PRINT

2110 PRINT " (THE EXPRESSION OF THE DEFINITION USING THE PARAMENTER OF

2120 PRINT " THE PARAMETER-LIST AND CONSTANTS. )

2130 PRINT

2140 PRINT

2150 PRINT " BEGIN TEST.

2160 PRINT

2170 DEF FND (Y) =Y"4-16

2180 LET A=4

2190 LET B=2

2200 LET Y=FND (A''3-3*A''2*B+3*A*B ''2-B ''3) 2210 IF Y=4080 THEN 2240

2220 PRINT "SYSTEM FAILED TEST."

2230 GOTO 2250

2240 PRINT "SYSTEM PASSEtl TEST."

2250 PRINT

2260 PRINT " END TEST.

2270 PRINT

3060 PRINT

3070 PRINT

3080 PRINT

3090 PRINT " SECTION 111.4"

3100 PRINT

3110 PRINT " (THE EXPRESSION OF THE DEFINITION USING THE PA RAM ENTER OF

3120 PRINT " THE PARAMENTER-LIST AND THE REFERENCE OF ANOTHER DEFINI3130 PRINT " TION. )

3140 PRINT

3150 PRINT

3160 PRINT " BEGIN TEST."

3170 PRINT

3180 DEF FNE(Z)=Z"2-4

3190 DEF FNF (Z) =Z*X+FNE (A~2+B)

3200 LET A=9

3210 LET B=19

3220 LET X=3

3230 LET Y=2

3240 LET Z=FNF (X"3-3*X''2*Y + 3*X*Y >

to 1K "3)

3250 IF Z=9999 THEN 3280

3 260 PRINT "SYSTEM FAILED TEST."

3270 GOTO 3290

3280 PRINT "SYSTEM PASSED TEST."

3290 PRINT

3300 PRINT " END TEST."

3310 PRINT

6U
3320 END

'k’k'k'k'k'k'k'kic'kicic-k'kicicic * SAMPLE OUTPUT *

'k’kicic'kicitit-kicicic^'kic-k-k

I PROGRAM FILE 111

SECTION 111.0.

TESTING USER-DEFINED FUNCTIONS WITH PARAMETER LISTS

*****NOTE: THIS UNIT IS ALSO A PRELIMINARY INTRODUCTION TO

FUNCTIONS OF EXPRESSIONS. MORE EXTENSIVE CASES WILL OCCUR

IN A LATER UNIT.*****

SECTION 111.1

(THE EXPRESSION OF THE DEFINITION USING ONLY THE PARAMENTER

OF THE PARAMENTER-LIST.

)

BEGIN TEST.

SYSTEM PASSED TEST.

END TEST.

SECTION 111.2

(THE EXPRESSION OF THE DEFINITION USING THE PARAMETER OF

THE PARAMENTER-LIST AND OTHER VARIABLES.)

BEGIN TEST.

SYSTEM PASSED TEST.

|1

j END TEST.

I

65
SECTION 111.3

(THE EXPRESSION OF THE DEFINITION USING THE PARAMENTER OF

THE PARAMETER-LIST AND CONSTANTS.)

BEGIN TEST.

SYSTEM PASSED TEST.

END TEST.

SECTION 111.4

(THE EXPRESSION OF THE DEFINITION USING THE PARAMENTER OF

THE PARAMENTER-LIST AND THE REFERENCE OF ANOTHER DEFINITION.)

BEGIN TEST.

SYSTEM PASSED TEST.

END TEST.

66
112.0 TESTING ALL POSSIBLE PARAMETRIZED USER DEFINED

FUNCTION SPECIFICATIONS

The objective of this test is to verify that there are a total of 26

possible user defined function definitions permitted in a single program (see

section 16.2 of BSR X3.60). This code tests whether the implementation

allows the following general syntax form for a user defined function

statement

;

DEF FNx (par ameter ) =expressi on where x is a single letter (that is, one of the 26 alphabetic letters) and a parameter is a simple-numeric-variable. The test verifies this by using 26

def-statements defined in order from A through Z in lines 150 to 400 of the source code. When called in the program, the values of the 26 defined

functions should decrease in value in the following order 4, 3, 2, 1,

-21 and their total sum should be -221. On output, there should be a message

informing the user whether the implementation passed or failed the test.

•k'k'k-k-k'k-kificicif'k'k'k'kic-k'k'kif * PROGRAM FILE 112 *

'k'k'k'k'kic'k^-k'k'k'kit'k'kif'k'k'k'k

0010 PRINT "PROGRAM FILE 112"

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT " SECTION 112;

0095 PRINT " 0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT " 0140 PRINT

0150 DEF FNA (X) =X/7-7

0160 DEF FNB (X) =X/8-8

0170 DEF FNC (X) =X/9-9

0180 DEF FND (X) =X/10- 10

0190 DEF FNE (X) =X/11-11

0200 DEF FNF (X) =X/12- 12

0210 DEF FNG (X) =X/13- 13

0220 DEF FNH (X) =X/14- 14

0230 DEF FNI (X) =X/15- 15

0240 DEF FNJ (X) =X/16- 16

0250 DEF FNK (X) =X/17- 17

0260 DEF FNL (X) =X/18- 18

0270 DEF FNM (X) =X/19- 19

0280 DEF FNN (X) =X/20- 20

TESTING ALL 26 POSSIBLE DEFINITIONS"

FOR DEFINED FUNCTIONS"

BEGIN TEST."

6T
0290 DEF FNO (X) =X/21-21

0300 DEF FNP(X)=X/22-22

0310 DEF FNQ(X)=X/23-23

0320 DEF FNR(X)=X/24-24

0330 DEF FNS (X)=X/25-25

0340 DEF FNT(X)=X/26-26

0350 DEF FNU (X) =X/27-27

0360 DEF FNV(X)=X/28-28

0370 DEF FNW (X)=X/29-29

0380 DEF FNX (X) =X/30-30

0390 DEF FNY(X)=X/31-31

0400 DEF FNZ (X) =X/32-32

0410 DIM A(26)

0420 LET A(1)=FNA(77)

0430 LPT A(2)=FNB(88)

0440 LET A(3)=FNC (99)

0450 LET A(4)=FND(110)

0460 LET A(5)=FNE (121)

0470 LET A(6)=FNF(132)

0480 LET A(7)=FNG(143)

0490 LET A (8) =FNH (154)

0500 LET A(9)=FNI (165)

0510 LET A(10)=FNJ (176)

0520 LET A(11)=FNK(187)

0530 LET A(12)=FNL(198)

0540 LET A(13)=FNM(209)

0550 LET A(14)=FNN (220)

0560 LET A(15)=FNO(231)

0570 LET A(16)=FNP(242)

0580 LET A(17)=FNQ(253)

0590 LET A (18) =FNR (264)

0600 LET A(19)=FNS (275)

0610 LET A(20)=FNT(286)

0620 LET A(21)=FNU (297)

0630 LET A(22)=FNV(308)

0640 LET A (23) =FNW (319)

0650 LET A(24)=FNX(330)

0660 LET A (25) =FNY (341)

0670 LET A (26) =FNZ (352)

0680 LET S = 0 0690 FOR 1=1 TO 26

0700 LET S=S+A(I)

0710 NEXT I 0720 IF S=-221 THEN 750

0730 PRINT "SYSTEM FAILED TEST.

0740 GOTO 760

0750 PRINT "SYSTEM PASSED TEST.

0760 PRINT

0770 PRINT " 0780 PRINT

0790 END

END TEST.

"kisificifiiiiic-kiciiif-kiiicicic

68
* SAMPLE OUTPUT *

-k-k-kisiciciciciticic-k-kicitlt-k

PROGRAM FILE 112

SECTION 112; TESTING ALL 26 POSSIBLE DEFINITIONS

FOR DEFINED FUNCTIONS

BEGIN TEST.

SYSTEM PASSED TEST.

END TEST.

69
113.0

USER DEFINED FUNCTIONS WITHOUT A PARAMETER LIST

This section tests some of the forms that expressions can have in the

definition of a user defined function without a parameter list (see section

16 of BSR X3.60). We will execute expressions of the general form:

DEF FNx=expr ess ion

where x is a single letter.

113.1

The Definition Uses Only a Constant

This subtest verifies that the expression of a nonpar ametr i zed user defined

function can be a constant. In particular we define:

DEF FNx=3. 14159

where x is a single letter. On output, there should be a message to the user indicating whether the implementation passed or failed the test.

113.2

The Definition Uses a Variable

This subtest verifies that the expression of a nonparametr i zed user defined function can be a variable. In fact the test determines whether an implementation allows a DEF statement of the following form:

DEF FNx=Z*Z

where x is a single letter. On output, there should be a message indicating

whether the implementation passed of failed the test.

113.3

The Definition Uses Both Constants and Variables

This subtest verifies that the expression in the definition can use both

constants and variables together in an expression of the form:

DEF FNx=A''2+8*A*B + 16

where x is a single letter. On output, there should be a message indicating

whether the implementation passed or failed the test.

113.4

The Definition References Another Defined Function

This subtest verifies that the expression of a nonpar aniet r. i zed

definition can contain a reference to another defined function. The

following expressions are used in this test:

DEF FND=X"4-1

DEF FNE=FND+45

where D and E are the single letters which make the distinguishing factor

between the two definitions. On output, there should be a message indicating

whether the implementation passed or failed the test.
•kic-k-k-kicic-k'k-k-k-k'k-k-k-k'k-k-k-k * PROGRAM FILE 113 *

k'k’k-k’k-kiciticicic-k'k'kic-kifkit-k

1050 PRINT "PROGRAM FILE 113"

1060 PRINT

1070 PRINT

1080 PRINT

1085 PRINT " SECTION 113.0: DEFINED FUNCTIONS WITHOUT A PARAMETER LIST"

1100 PRINT

1110 PRINT

1120 PRINT

1130 PRINT " SECTION 113.1"

1140 PRINT

1150 PRINT " (THE EXPRESSION OF THE DEFINITION USING A CONSTANT. )

1160 PRINT

1170 PRINT

1180 PRINT " BEGIN TEST."

1190 PRINT

1200 DEF FNA=3. 14159

1210 LET A=10

1220 LET Y=FNA*A"2

1230 LET X=(Y-314. 159)/314. 159

1240 IF X < 3.1831E-6 THEN 12‘70

1250 PRINT "SYSTEM FAILED TEST."

1 1260 GOTO 1280

1270 PRINT "SYSTEM PASSED TEST."

1280 PRINT

, 1290 PRINT " END TEST,."

1300 PRINT

'' 2070 PRINT

i| 2080 PRINT

1 2090 PRINT " SECTION J13.2"

1 2100 PRINT

\ 2110 PRINT " (THE EXPRESSION OF THE DEFINITION USING A VARIABLE. )

i 2120 PRINT

2130 PRINT

214 0 PRINT " BEGIN TES'l'."

1' 2150 PRINT

i 216 0 DEF FNB=X*X

II 2170 LET X=31

|l 2180 LET Y=FNB+38

m 2190 IF Y=999 THEN 2220

1 2200 PRINT "SYSTEM FAILED TEST." ^

2210 GOTO 2230

2220 PRINT "SYSTEM PASSED TEST."

2230 PRINT

2 24 0 PRINT " END TEST.

1(1 2250 PRINT

3070 PRINT

If 3080 PRINT

3090 PRINT " SECTION 113.3"

3100 PRINT

71
3110

3120

3130

3140

3150

3160

3170

3180

3190

3200

3210

3220

3230

3240

3250

3260

3270

4070

4080

4090

4100

4110

4120

4130

4140

4150

4160

4170

4180

4190

4200

4210

4220

4230

4240

4250

4260

4270

4280

PRINT "(THE EXPRESSION OF THE DEFINITION USING BOTH CONSTANTS AND"

PRINT " VARIABLES TOGETHER. )

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

DEF FNC=A''2+8*A*B+16

LET A=5

LET B=4

LET C=FNC"2-1

IF C=40400 THEN 3240

PRINT "SYSTEM FAILED TEST."

GOTO 3250

PRINT "SYSTEM PASSED TEST."

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " SECTION 113.4"

PRINT

PRINT "(THE EXPRESSION OF THE DEFINITION USING THE REFERENCE OF"

PRINT " ANOTHER DEFINITION FOR ONE OF ITS TERMS.)"

PRINT

PRINT

PRINT "

. BEGIN TEST."

PRINT

DEF FND=X"4-1

DEF FNE=FND+45

LET X=2

LET Y=FNE+602

IF Y=3660 THEN 4240

PRINT "SYSTEM FAILED TEST."

GOTO 4250

PRINT "SYSTEM PASSED TEST."

PRINT

PRINT " END TEST."

PRINT

END

kfc-kititicititiiitiiiflt-kiticii * SAMPLE OUTPUT *

Irititir-kititititit'kic'kit-kisii

PROGRAM FILE 113

SECTION 113.0: DEFINED FUNCTIONS WITHOUT A PARAMETER LIST

72
SECTION 113.1

(THE EXPRESSION OF THE DEFINITION USING A CONSTANT.)

BEGIN TEST.

SYSTEM PASSED TEST.

END TEST.

SECTION 113.2

(THE EXPRESSION OF THE DEFINITION USING A VARIABLE.)

BEGIN TEST.

SYSTEM PASSED TEST.

END TEST.

SECTION 113.3

(THE EXPRESSION OF THE DEFINITION USING BOTH CONSTANTS AND

VARIABLES TOGETHER.)

SYSTEM PASSED TEST.

BEGIN TEST.

END TEST.

SECTION 113.4

(THE EXPRESSION OF THE DEFINITION USING THE REFERENCE OF

ANOTHER DEFINITION FOR ONE OF ITS TERMS.)

SYSTEM PASSED TEST.

BEGIN TEST.

END TEST.

73
114.0 USER DEFINED FUNCTION DIAGNOSTICS - THE SAME FUNCTION

IS DEFINED MORE THAN ONCE

The objective of this test is to show that the implementation will

recognize that defining the same function more than once in the same program

is semantically meaningless (see section 16.4 of bSR X3.60). The

processor should provide a diagnostic, although this error

‘ * an exception. In order to test this, the same function is

line 340 andd 350 of the program below. The user diagnostic noting the double definition. However, if one

IS not considered

defined both in

should look for a of the function

definitions is ignored by the implementation, then the test program will

produce an error message indicating test failure.

'kic’k'k'k'kicit-kif-kilifif-k-kitic-kit * PROGRAM FILE 114 *

•kicic-kificititif'kifiticificitititicit

0010

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0 4 00

0410

0420

0430

0440

0450

0460

0470

PRINT "PROGRAM FILE 114"

PRINT

PRINT

PRINT

PRINT " SECTION 114.0"

PRINT

PRINT " (THE SAME FUNCTION

PRINT

PRINT

PRINT " PRINT

DEF FNA (X) =X''4-1

DEF FNA(X)=A*X+B

LET A=5

LET B=6

LET Y=FNA(2)

PRINT " Bi: THE APPEARANCE OF THIS

PRINT "THAT THE SYSTEM HAS FAILED THE

PRINT

PRINT Y PRINT

PRINT "T3E ABOVE VALUE SHOULD NOT HAVE BEEN EVALUATED."

PRINT " END TEST.

PRINT

END

IS DEFINED MORE THAN ONCE.)

BEGIN TEST."

STATEMENT, IT IS VERIFIED"

TEST.

N

7*4
* SAMPLE OUTPUT *

•kicicicis'k’kic-k-kis'k-k-kit’klt

?FUNCTION DEFINED TWICE IN LINE 350

75
115.0 A USER DEFINED FUNCTION IS REFERENCED INSIDE

ITS OWN DEFINITION

The objective of this test is to verify that the implementation will

recognize the referencing of a function within its own definition as semantically nonmeaningful and provide a diagnostic (see section 16.4 of BSR

X3.60). On output there should be some form of implementation defined

diagnostic. However, if the system ignores the illegal definition then a message within the program indicates test failure.

ieic'kic'kit-kicicic'k'kic'kit'kicicitic * PROGRAM FILE 115 * ********************

0010

0020

0030

0040

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

PRINT "PROGRAM FILE 115"

PRINT

PRINT

PRINT

PRINT " SECTION 115.0"

PRINT

PRINT " (A FUNCTION IS REFERENCED INSIDE ITS DEFINITION.)"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

DEF FNB(X)=X*X+FNB(2)

LET Y=FNB(2)

PRINT " BY THE APPEARANCE OF THIS STATEMENT, IT IS VERIFIED"

PRINT "THAT THE SYSTEM HAS FAILED THE TEST."

PRINT

PRINT Y PRINT

PRINT "THE ABOVE VALUE SHOULD NOT HAVE BEEN EVALUATED."

PRINT

PRINT " end test."

PRINT

END

'klt'kit'k'kiiiiit-k-kifititltitlc * SAMPLE OUTPUT *

76
PROGRAM FILE 115

SECTION 115.0

(A FUNCTION IS REFERENCED INSIDE ITS DEFINITION.)

BEGIN TEST.

7FUNCTION CALLS ITSELF IN LINE 170

TT
116.0 SYNTAX DIAGNOSTIC - ARGUMENT LIST USED INCORRECTLY WITH

A DEF FUNCTION

This

argument 1 X3. 60) . functions

.

argument 1

test verifies that the implementation diagnoses an incorrectly used

ist in a "defined" function call statement (see section 16.2 of BSR

This is a test of syntax specification for user-defined

The only output should be a message pinpointing an improper

ist in line 170.

* PROGRAM FILE 116 *

'k’kicic'kic-k'klcitieisicic'kicic'kif'k

0010 PRINT "PROGRAM FILE 116 II 0 0 60 PRINT

0070 PRINT

0080 PRINT

0090 PRINT " SECTION 116.0"

0100 PRINT

0110 PRINT " ARGUMENT LIST USED INCORRECTLY WITH A DEF FUNCTION"

0120 PRINT

0130 PRINT

0140 PRINT " BEGIN TEST."

0150 PRINT

0160 DEF FNA=3. 14159

0170 LET Y=FNA(3. 14159)

0180 PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE

0190 PRINT "MENT, THE SYSTEM HAS FAILED THE TEST.

0200 PRINT Y 0210 PRINT

0220 PRINT " END TEST."

0230 PRINT

0240 END

it-k-icirit-k'kit'kicic'k'k-kit-kit * SAMPLE OUTPUT *

k-kit’kit'kiticititic-kic'k’kit'k

7INCORRECT NUMBER OF ARGUMENTS IN LINE 170

78
117.0 SYNTAX DIAGNOSTIC NO ARGUMENT LIST FOR THE ABS FUNCTION

This test determines whether not using an argument with the ABS function

causes a syntax diagnostic (see sections 7 and 8 of BSR. X3.60). The ABS

function appears in an expression on line 210 without its argument. On

output, there should be some form of implementation defined diagnostic

indicating the error. However if the illegal statement is ignored the test

is structured to generate an error message to the user.

k'kif-k'kic-k-k'k'kicicic'kit’k'kicic'k * PROGRAM FILE ll'' *

'k'k'kif-kiticic'k-kic'kicic-kic-k’kif’k

0010

0020

0030

0040

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

PRINT "PROGRAM FILE ll’’"

PRINT

PRINT

PRINT

PRINT " SECTION H‘7.0"

PRINT

PRINT " INCORRECT ARGUMENT LIST WITH THE ABS FUNCTION"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Y=ABS

PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

PRINT "MENT, THE SYSTEM HAS FAILED THE TEST."

PRINT Y

PRINT

print " END TEST."

PRINT

END

* SAMPLE OUTPUT *

7INC0RRECT NUMBER OF ARGUMENTS IN LINE 210

79
118.0 SYNTAX DIAGNOSTIC NO ARGUMENT LIST WITH ATN

This test determines

diagnostic when ATN has

section and 8 of BSR

contains no arguments,

ignores the line then the

whether the processor will provide

an incorrect number of arguments on line

X3.60). This particular reference

If the system does not provide a diagn

output will provide a message to the user.

'kicitic-k'k'k'k-k-kicitii'kic-k'k'k-kit * PROGRAM FILE 118 *

ic’k'k'k'kicicic'kif-kicic^ii-kie'k-ki:

0010

0020

0030

0040

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

PRINT "PROGRAM FILE 118"

PRINT

PRINT

PRINT

PRINT " SECTION 118.0"

PRINT

PRINT " NO ARGUMENT LIST WITH THE ATN FUNCTION"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Y=ATN

PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE

PRINT "MENT, THE SYSTEM HAS FAILED THE TEST."

PRINT Y PRINT

PRINT " END TEST."

PRINT

END

"k-k-kitifitif-k-kisificitifit-kit * SAMPLE OUTPUT *

7INCORRECT NUMBER OF ARGUMENTS IN LINE 160

syntax

160 (see

to ATN

Stic and

80
119.0 SYNTAX DIAGNOSTIC - NO ARGUMENT LIST WITH COS

This section

diagnostic when COS

X3..60). If the

message to the user

tests whether the processor will provide a syntax

has no argurament in line 160 (see sections 7 and 8 of BSR

statement is ignored then the program will provide a

********************

* PROGRAM FILE 119 *

•k-k'k-k'kic-kicicicic'k'kit-k-kicic'k-k

0010

0020

0030

0040

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

PRINT "PROGRAM FILE 119"

PRINT

PRINT

PRINT

PRINT " SECTION 119.0"

PRINT

PRINT " NO ARGUMENT LIST WITH COS FUNCTION"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Y=COS

PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

PRINT "MENT, THE SYSTEM HAS FAILED THE TEST."

PRINT Y

PRINT

PRINT " END TEST."

PRINT

END

•kic'kic'kiiisic'kif'kit'kit-k-k-k * SAMPLE OUTPUT *

it-k'k'kic'kicicitic'kic'kicic-kit

7INCORRECT NUMBER OF ARGUMENTS IN LINE 160

81
This

d iagnostic

X3. 60 ) . message to

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 LET y

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 END

7INC0RRECT

120.0 SYNTAX DIAGNOSTIC - NO ARGUMENT LIST WITH EXP

section tests whether the processor will provide a syntax

when EXP has no arguments in line 160 (see sections and 8 of BSR

If the statement is ignored then the program will provide a the user.

* PROGRAM FILE 120 *

'k^ic'k'kicic-k'kitit’kit'kic'k-kit-kit

"PROGRAM FILE 120"

SECTION 120.0"

NO ARGUMENT WITH THE EXP FUNCTION"

BEGIN TEST."

EXP

" WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

"MENT, THE SYSTEM HAS FAILED THE TEST."

Y

END TEST.

k'kifit'kic'kitictlifitifiKititit * SAMPLE OUTPUT *

•kicit'kiticicicic'kititicicic'k'k

NUMBER OF ARGUMENTS IN LINE 160

82
121.0 SYNTAX DIAGNOSTIC - NO ARGUMENT LIST WITH INT

Th i s d iagnost i

c

X3. 60 ) . message to

section tests whether the processor will provide a syntax

when INT has no argument in line 160 (see sections and 8 of BSR

If the statement is ignored then the program will provide a the user.

********************

* PROGRAM FILE 121 * ********************

010 PRINT 11 020 PRINT

030 PRINT

040 PRINT

090 PRINT II 100 PRINT

110 PRINT II 120 PRINT

130 PRINT

140 PRINT II 150 PRINT

160 LET Y ==i: 170 PRINT If 180 PRINT II 190 PRINT Y 200 PRINT

210 PRINT II 220 PRINT

230 END

"PROGRAM FILE 121"

SECTION 121.0"

NO ARGUMENT WITH THE INT FUNCTION

BEGIN TEST."

WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS

END TEST.

STATE-"

•kisicititisiciiit'k'kictcicif'M'k * SAMPLE OUTPUT *

ic'kic'k'kic'kicicie'kkic'kickif

7INCORRECT NUMBER OF ARGUMENTS IN LINE 160

83
This

diagnostic

X3.60). If

message to

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 LET Y=

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 END

122.0 SYNTAX DIAGNOSTIC - NO ARGUMENT LIST WITH LOG

section tests whether the processor will provide a syntax

when LOG has no argument in line 160 (see sections and 8 of BSR

the statement is ignored then the program will provide a the user.

'k'k-k-k'k-k-k’k’k'kicick-k-k-k-k-kitic * PROGRAM FILE 122 *

it'k'k'kis'k-k'k’k'k'k'k'k-k-k'k-kicit'k

"PROGRAM FILE 122"

SECTION 122.0"

NO ARGUMENT LIST WITH LOG FUNCTION"

BEGIN TEST."

LOG

" WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

"MENT, THE SYSTEM HAS FAILED THE TEST."

Y

" END TEST."

if-k-kitii'k'k'k-k-k-k-kitif'k'kit * SAMPLE OUTPUT *

k-kitititit’kitititif'kicic-k'kit

7INCORRECT NUMBER OF ARGUMENTS IN LINE 160
This

d iagnost i

c

X3.60). If

message to

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 LET Y 0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 END

?INCORRECT

123.0 SYNTAX DIAGNOSTIC - NOARGUHENT LIST WITH SGN

section tests whether the processor

when SGN has no argument in line

the statement is ignored then the

the user.

will

160

prog

provide a (see section 8 ram will prov

syntax

of BSR

i de a

‘k'kic-k-kic'k-k-k-kiticiicificickificif * PROGRAM FILE 123 *

•k'k'k-kicic'kic'k'k'k'k-kit'kic-kiekic

"PROGRAM FILE 123"

SECTION 123.0"

NO ARGUMENT LIST WITH THE SGN FUNCTION"

BEGIN TEST."

SGN

" WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

"MENT, THE SYSTEM HAS FAILED THE TEST."

Y END TEST.

k'kic'k'A'k'k'kicific'k'kkicic'k * SAMPLE OUTPUT *

NUMBER OF ARGUMENTS IN LINE 160

85
124.0 SYNTAX DIAGNOSTIC - NO ARGUMENT LIST WITH SIN

This

d iagnostic

X3. 60) . message to

section tests whether the processor

when SIN has no argument in line

If the statement is ignored then the

the user.

will provide a syntax

160 (see section 8 of BSR

program will provide a

iticieicicic-kiK-k-k'k-kiticitif-icie-k'k * PROGRAM FILE 124 *

'k’k’k'k'k’k'kic'kicitic'k'kifit-kicicif

0010

0020

0030

0040

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

PRINT "PROGRAM FILE 124"

PRINT

PRINT

PRINT

PRINT " SECTION 124.0"

PRINT

PRINT " NO ARGUMENT • LIST WITH THE SIN FUNCTION"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Y=SIN

PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

PRINT "MENT, THE SYSTEM HAS FAILED THE TEST."

PRINT Y

PRINT

PRINT " END TEST."

PRINT

END

k-kic-k'kitific-kic-k-kif'kifitit * SAMPLE OUTPUT *

it'kicic'k-k'k-k'k'k'kltiriticitit

7INCORRECT NUMBER OF ARGUMENTS IN LINE 160

86
125.0 SYNTAX DIAGNOSTIC - NO ARGUMENT LIST WITH SQR

This section tests whether the processor

diagnostic when SQR has no argument in line

X3.60). If the statement is ignored then the

message to the user.

will provide

160 (section

program will

a syntax

8 of BSR

provide a

icic'kieicie'k-kir'kititicif-kit-kicit-k * PROGRAM FILE 125 *

•k'kic'kicitic’k'kic-k’kiciticit^'kif-k

0

00

0

0

0

0

00

0

00

00

0

0

00

0

010 PRINT

020 PRINT

030 PRINT

040 PRINT

090 PRINT

100 PRINT

110 PRINT

120 PRINT

130 PRINT

140 PRINT

150 PRINT

160 LET Y

170 PRINT

180 PRINT

190 PRINT

200 PRINT

210 PRINT

220 PRINT

230 END

"PROGRAM FILE 125"

SECTION 125.0"

NO ARGUMENT LIST WITH THE SQR FUNCTION"

BEGIN TEST."

=SQR

" WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-

"MENT, THE SYSTEM HAS FAILED THE TEST."

Y

" END TEST."

tt

is’kicic'k-kis'k'kicicif-kifific'k * SAMPLE OUTPUT *

'k-k’k'kitic'kicisieic’k'kic'kif-k

7INCORRECT NUMBER OF ARGUMENTS IN LINE 160

87
This

d iagnostic

X3. 60 ) . message to

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 LET Y

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 END

126.0 SYNTAX DIAGNOSTIC - NO ARGUMENT LIST WITH TAN

section tests whether the processor will provide a syntax

when TAN has no argument in line 160 (see section 8 of BSR

If the statement is ignored then the program will provide a the user.

k’kic-k-k'k-k-kic'k-k-k-k-kic-k-k'kit-k * PROGRAM FILE 126 *

’k'k'k’k'k’k'kit'kitit'kitit'klt'kisic^

"PROGRAM FILE 126"

SECTION 126.0"

NO ARGUMENT LIST WITH THE TAN FUNCTION

BEGIN TEST."

=TAN

" WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

"MENT, THE SYSTEM FAILED THE TEST."

Y END TEST."

iKic-kitit'k-k'kititiiitifiKitit-k * SAMPLE OUTPUT *

•kiK'kit'kilitis'k'kit'k-kit-k-k'k

7INC0RRECT NUMBER OF ARGUMENTS IN LINE 160
127.0 SYNTAX DIAGNOSTIC - A DEFINED FUNCTION WITH AN ARGUMENT

BUT CALLED WITHOUT IT

This section tests whether the processor will provide a syntax

diagnostic for a user-defined function called without an argument in line 1"'0 assuming that it had been defined with one in line 160 (see section 8 of BSR

X3.60). If the statement is ignored then the program will provide a message to the user.

k'k'k'kick-kic-k-k'k-kicic-k-kic-k-k-k * PROGRAM FILE 127 *

ic-kicic'k'k-k'kic'kicicic'kic'kic-kit-k

0010 PRINT "PROGRAM FILE 127"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT " SECTION 127.0"

0100 PRINT

0110 PRINT " DEFINED FUNCTION WITH A PARAMETER USED WITHOUT IT"

0120 PRINT

0130 PRINT

0140 PRINT " BEGIN TEST."

0150 PRINT

0160 DEF FNA(X)=X"2-1

0170 LET X=FNA+15

0180 PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

0190 PRINT "MENT, THE SYSTEM HAS FAILED THE TEST."

0200 PRINT Y 0210 PRINT

0220 PRINT " END TEST."

0230 PRINT

0240 END

'kkkif^fi('kkk•k'ki(i^icie•k^k * SAMPLE OUTPUT * kkkkkk'kkiskkk'k'k-kkk

7INCORRECT NUMBER OF ARGUMENTS IN LINE 170

89
128.0 SYNTAX DIAGNOSTIC ABS USED WITH TOO MANY ARGUMENTS

This section tests whether a processor will provide a syntax diagnostic

for an ABS function used with two arguments in line 210 (see section 8 of BSR

X3.60). If this statement is ignored then the program prints a message

to the user indicating test failure.

-kicif-kicicitic'kit-k-k-kic-kicic-kic-k * PROGRAM FILE 128 *

0010

0020

0030

0040

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

PRINT "PROGRAM FILE 128"

PRINT

PRINT

PRINT

PRINT " SECTION 128.0"

PRINT

PRINT " ABS WITH TOO MANY ARGUMENTS"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Y=ABS (-5,4)

PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

PRINT "MENT, THE SYSTEM HAS FAILED THE TEST.”

PRINT Y PRINT

PRINT " END TEST."

PRINT

END

* SAMPLE OUTPUT *

’kic'k'kic'k'kit-k'kicitit'kit'k'k

We will

appr opr i ate

indicate two possible

here. The first would

diagnostic messages that might be seem more informative.

? INCORRECT NUMBER OF ARGUMENTS IN LINE 210

90
or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 210

91
129.0 SYNTAX DIAGNOSTIC - ATN WITH TOO MANY ARGUMENTS

for

X3.

to

This section tests whether a an ATN function used with two

60). If the statement is

the user indicating test failu

processor will provide a syntax di

arguments in line 160 (see section

ignored then the program prints a re

.

agnostic

8 of BSR

message

•k'k^icic-kic'kickif-kic-klt-k-k-kicic * PROGRAM FILE 129 *

icitic-kicicigicicicis-kicicicislciticit

0010

0020

0030

0 0 4 0 0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

PRINT "PROGRAM FILE 129"

PRINT

PRINT

PRINT

PRINT " SECTION 129.0"

PRINT

PRINT " ATN WITH TOO MANY ARGUMENTS"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Y=ATN (-1. 57, 1. 57079)

PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

PRINT "MENT, THE SYSTEM HAS FAILED THE TEST."

PRINT Y PRINT

PRINT " END TEST."

PRINT

END

*****************

* SAMPLE OUTPUT *

'k'kirit'kic'kitit-kit-kit'k'kic'k

7INCORRECT NUMBER OF ARGUMENTS IN LINE 160

or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 160

92
I

130.0 SYNTAX DIAGNOSTIC - COS USED WITH TOO MANY ARGUMENTS

This section tests whether a processor will provide a syntax diagnostic

for a COS function used with two arguments in line see section 8 of BSR

X3.60 ). If this statement is ignored then the program prints a message

to the user indicating test failure.

k'k’kit'kicleiKic^-kic-kickisiickit-k * PROGRAM FILE 130 *

•kis'kidcickifkic-k-kic-kic-kicitkic

010 PRINT

020 PRINT

030 PRINT

040 PRINT

090 PRINT

100 PRINT

110 PRINT

120 PRINT

130 PRINT

140 PRINT

150 PRINT

160 LET Y

1-70 PRINT

180 PRINT

190 PRINT

200 PRINT

210 PRINT

220 PRINT

230 END

"PROGRAM FILE 130"

" SECTION 130.0"

" COS WITH TOO MANY ARGUMENTS"

" BEGIN TEST."

=COS (1. 5,1. 37)

" WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-

"MENT, THE SYSTEM HAS FAILED THE TEST."

Y

" END TEST."

kkkkkkkkkkkkkkkkk

* SAMPLE OUTPUT * kkkkkkkkkkkkkkkkk

?INCORRECT NUMBER OF ARGUMENTS IN LINE 160

or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 160

93
131.0 SYNTAX DIAGNOSTIC - EXP USED WITH TOO MANY ARGUMENTS

This section tests whether a processor will provide a syntax diagnostic

for an EXP function used with two arguments in line 160 (see section 8 of BSR

X3.60). If this statement is ignored then the program prints a message

to the user indicating test failure.

if-k'kicit'k'k-k'kit'k'k-kitic'kicifit'k * PROGRAM FILE 131 *

itiK-kit'kitit’k'k'kititific-k'k'kificif

0010 PRINT "PROGRAM FILE 131"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT tl SECTION 131.0"

0100 PRINT

0110 PRINT II EXP WITH TOO MANY ARGUMENTS"

0120 PRINT

0130 PRINT

0140 PRINT *' BEGIN TEST."

0150 PRINT

0160 LET Y ==EXP (5,-2)

0170 PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS

0180 PRINT "MENT, THE SYSTEM HAS FAILED THE TEST.

0190 PRINT Y 0200 PRINT

0210 PRINT II END TEST.

0220 PRINT

0230 END

it'kitifitit'kicicic-kitiiit-kitit * SAMPLE OUTPUT *

•icicicitfc’k’k'kit'kit'k-kitit-klf

PINCORRECT NUMBER OF ARGUMENTS IN LINE 160

or

?, WAS SEEN WHERE WAS EXPECTED IN LINE 160
132.0 SYNTAX DIAGNOSTIC INT USED WIITH TOO MANY ARGUMENTS

This section tests whether a processor will provide a syntax diagnostic

for the INT function used with two arguments in line 160 (see section 8 of

BSR X3.60). If this statement is ignored then tthe program prints a message to tthe user indicating test failure.

•kitic'k'k-kic-kit'k-kiciKic-kic'kie-kit * PROGRAM FILE 132 *

-k'kit-kit'kicicicic'kic-kiticic-kic’kit

010 PRINT "PROGRAM FILE 132"

020 PRINT

030 PRINT

040 PRINT

090 PRINT " SECTION 132.0"

100 PRINT

110 PRINT It INT WITH TOO MANY ARGUMENTS"

120 PRINT

130 PRINT

140 PRINT M BEGIN TEST."

150 PRINT

160 LET Y ==INT(1.3,-1.3)

170 PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS

180 PRINT "MENT, THE SYSTEM HAS FAILED THE TEST.

190 PRINT Y

200 PRINT

210 PRINT If END TEST.

220 PRINT

230 END

k'k'kit'kicic-kicisisif-kit'kic-k * SAMPLE OUTPUT *

7INC0RRECT NUMBER OF ARGUMENTS IN LINE 160

or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 160

95
133.0 SYNTAX DIAGNOSTIC LOG USED WITH TOO MANY ARGUMENTS

This section tests

for the LOG function

BSR X3. 60) , If this

message to the user ind

whether a used with

statement

icating te

processor will

two arguments

is ignored

St failure.

provide a syntax diagnostic

in line 160 (see section 8 of

then the program prints a

"k'k’k'k'kicit'kific'kic-k-k-kitit'k'kit * PROGRAM FILE 133 *

•kisrkic-kicit-k’kit’k'k-kitk’k-k’kitic

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

"PROGRAM FILE 138"

SECTION 133.0"

LG 3 WITH TOO MANY ARGUMENTS"

BEGIN TEST."

0ib0 PRINT

0160 LET Y=LOG(15,25)

0170 PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

0180 PRINT "MENT, THE SYSTEM HAS FAILED THE TEST."

0190 PRINT Y

0200 PRINT

0210 PRINT " END TEST."

0220 PRINT

0230 END

*****************

* SAMPLE OUTPUT *

k'k-k'kicltit'k-k'k'kitititlcic'k

7INCORPECT NUMBER OF ARGUMENTS IN LINE 160

or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 160

96
134.0 SYNTAX DIAGNOSTIC SGN USED WITH TOO MANY ARGUMENTS

This section tests whether a processor

for a SGN function used with two arguments

X3.60). If this statement is ignored then

the user indicating test failure.

will provide a syntax diagnostic

in line 160 (see section 8 of BSR

the program prints a message to

k-k'k-kic’kic'k-k'k-k-k'k'k-k-k'kic-k-k * PROGRAM FILE 134 *

•kic-k'k-k-k'k-kic'k’kic’k-kic'kic'k'k'k

0010

0020

0030

0040

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

PRINT "PROGRAM FILE 134"

PRINT

PRINT

PRINT

PRINT " SECTION 134.0"

PRINT

PRINT " SGN WITH TOO MANY ARGUMENTS"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Y=SGN (-15,-18)

PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOW THIS STATE-"

PRINT "MENT, THE SYSTEM HAS FAILED THE TEST."

PRINT Y PRINT

PRINT " END TEST."

PRINT

END

* SAMPLE OUTPUT *

7INCORRECT NUMBER OF ARGUMENTS IN LINE 160

or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 160

97
135.0 SYNTAX DIAGNOSTIC SIN USED WITH TOO MANY ARGUMENTS

This section tests whether a processor will provide a syntax diagnostic

for a SIN function used with two arguments in line 160 (see section 8 of BSR

X3.60). If this statement is ignored then the program prints a message

to the user indicating test failure.

•kifificititir-kific-k-k-kifltit’k-kic-k * PROGRAM FILE 135 *

-kiiic'k'kit-k'kic’kicit'k'k’klt'k'kitit

0010 PRINT "PROGRAM FILE 135"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT •t SECTION 135.0"

0100 PRINT

0110 PRINT " SIN WITH TOO MANY ARGUMENTS"

0120 PRINT

0130 PRINT

0140 PRINT •t BEGIN TEST."

0150 PRINT

0160 LET Y^=SIN (1.375,1.57)

01^0 PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS

0180 PRINT "MENT, THE SYSTEM HAS FAILED THE TEST.

0190 PRINT Y 0200 PRINT

0210 PRINT • 1 END TEST."

0220 PRINT

0230 END

THIS STATE-"

* SAMPLE OUTPUT *

'kithitifititif'kitititit'kiciiit

VINCORRECT NUMBER OF ARGUMENTS IN LINE 160

or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 160

98
136.0 STOTAX DIAGNOSTIC SQR USED WITH TOO MANY ARGUMENTS

This section tests whether a processor will provide a syntax diagnostic

for a SQR function used with two arguments in line 160 (see section 8 of BSR

X3.60 ). If this statement is ignored then the program prints a message

to the user indicating test failure.

kicicicicicicic'kkicif-k-k * PROGRAM FILE

'k'k'kkkit'k’kifit’k'kic’k

k k k k k k 136 *

k k k k k k

0010 PRINT "PROGRAM FILE 136"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT " 0100 PRINT

0110 PRINT " 0120 PRINT

0130 PRINT

0140 PRINT " 0150 PRINT

0160 LET Y=SQR(16,25)

0170 PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE-"

0180 PRINT "MENT, THE SYSTEM HAS FAILED THE TEST."

0190 PRINT Y 0200 PRINT

0210 PRINT " 0220 PRINT

0230 END

SECTION 136.0"

SQR WITH TOO MANY ARGUMENTS"

BEGIN TEST."

END TEST.

kkkkkkkkkkkkkkkkk

* SAMPLE OUTPUT * kkkkkkkkkkkkkkkkk

?INCORRECT NUMBER OF ARGUMENTS IN LINE 160

or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 160

99
13’’. 0 SYNTAX DIAGNOSTIC TAN USED WITH TOO MANY ARGUMENTS

for

X3.

to

This section tests whether a processor will provide a syntax di

a TAN function used with two arguments in line 160 (see section

60). If this statement is ignored then the program prints a the user indicating test failure.

agnostic

8 of BSR

message

'k'kic-k'k'k-kititit-kitic-k-kit-tc-k'kii * PROGRAM FILE 137 *

'k'kif'kititit'k’k’k'kitititicificic’k'k

0 0 10

0 0 20

0 0 30

0 0 40

0 0 90

0 1 00

0 1 10

0 1 20

0 1 30

0 1 40

0 1 50

0 1 60

0 1 70

0 1 80

0 1 90

0 2 00

0 2 10

0 2 20

0 2 30

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET Y PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

END

"PROGRAM FILE 13''"

SECTION 137.0"

TAN WITH TOO MANY ARGUMENTS"

BEGIN TEST."

=TAN (1.5707,-1.5707)

" WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THE STATE-

"MENT, THE SYSTEM HAS FAILED THE TEST."

Y

" END TEST."

n

h’k'kif’k’kitititicificicicit’kit * SAMPLE OUTPUT *

•kitit’kitititititit'kit-k'kit-k'k

PINCORRECT NUMBER OF ARGUMENTS IN LINE 160

or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 160

100
138.0 SYNTAX DIAGNOSTIC - DEFINED FUNCTION WITH MORE THAN

ONE ARGUMENT

This section tests whether a processor will provide a syntax diagn

for a user defined function that is called with too many argumments in

190 (see section 16 of BSR X3.60 ). If this statement is ignored

the program prints a message to the user indicating test failure.

'k'k'k'kit'k-k-kitie'kitic'kit'k-icicit-k * PROGRAM FILE 138 *

•kit'k'k’kic'k'k'kif'k-kic'k-kit-kltif-k

0010 PRINT "PROGRAM FILE 138 " 0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT " SECTION 13 8.0"

0100 PRINT

0110 PRINT " DEFINED FUNCTION WITH MORE THAN ONE ARGUMENT"

0120 PRINT

0130 PRINT

0140 PRINT " BEGIN TEST."

0150 PRINT

0160 DEF FNA(X)=X*A+B

0170 LET A=5

0180 LET B=6

0190 LET Y=FNA{5,6)

0200 PRINT " WHETHER OR NOT A NUMERICAL VALUE FOLLOWS THIS STATE

0210 PRINT "MENT, THE SYSTEM HAS FAILED THE TEST.

0220 PRINT Y

0230 PRINT

0240 PRINT " END TEST."

0250 PRINT

0260 END

*****************

* SAMPLE OUTPUT *

kif’kic'kis-k'kicit'k'kic-k-k-k-k

?INCORRECT NUMBER OF ARGUMENTS IN LINE 190

Stic

line

then

101
or

?, WAS SEEN WHERE ) WAS EXPECTED IN LINE 190

102
139.0 SYNTAX DIAGNOSTIC A DEFINED FUNCTION WITH ILLEGAL ARGUMENT

This section tests whether a processor will provide a syntax diagnostic

for a user defined function that is called with an argument in line 130, when

the function was defined without an argument in line 120 (see section 16 of

BSR X3.60). If the statement is ignored the program will print a message to the user indicating test failure.

•k'kic'k'kicic'k'kic'kicicis'k-k'kic'k'k * PROGRAM FILE 139 *

•k-k’k'k-k'k'k-k-kic'k'k'k'k’kic'k’kic'k 10

20

30

40

50

60

70

80

90

100

110

120

130

140

145

150

160

170

PRINT "PROGRAM FILE 139"

PRINT

PRINT

PRINT

PRINT " SECTION 139.0"

PRINT

PRINT " DEFINED FUNCTION WITH ILLEGAL ARGUMENT"

PRINT

PRINT

PRINT " BEGIN TEST"

PRINT

DEF FNE = 2.7183

LET Z = FNE (2)

PRINT "THE SYSTEM FAILS THE TEST IF THIS LINE IS PRINTED WITH

PRINT "DIAGNOSTIC MESSAGE."

PRINT

PRINT " END TEST"

END

NO"

ic-k-kic'k'k'k-kic’kicicic-k-k'k-k * SAMPLE OUTPUT *

kit'k'k'kit-k'kif-kic'kicifit'kif

7INC0RRECT NUMBER OF ARGUMENTS IN LINE 130

103
140.0 SYNTAX DIAGNOSTIC - REFERENCE TO AN UNDEFINED FUNCTION

This section tests whether a processor will provide a syntax diagnostic

when a program makes reference to an undefined function in line 1'’0 (see

section 16 of BSR X3.60). The user should be warned that some systems

might diagnose this syntax error as a reference to an illegal variable.

Others may correctly diagnose the undefined function as such. If the system

totally ignores the statement then a failure diagnostic is included in the

test

.

ic'kitic'kicit-k-kitic-kie-k'k'kisis-kic * PROGRAM FILE 140 *

•kititif'k'k'kicic'k'k'kififit'k-k-kicit

10 PRINT " PROGRAM FILE 140"

20 PRINT

30 PRINT

40 PRINT

90 PRINT " SECTION 140.0"

100 PRINT

110 PRINT II REFERENCE TO AN UNDEFINED FUNCTION"

120 PRINT

130 PRINT

140 PRINT

150 PRINT tl BEGIN TEST"

160 PRINT

1"'0 LET Y = FNX(15) + 3 180 PRINT "IF THIS LINE IS PRINTED THE SYSTEM HAS FAILED THE TEST"

200 PRINT

210 PRINT II END TEST"

220 END

k'k-kitifltit'kitifit'kiiititit'k * SAMPLE OUTPUT * *****************

7UNDEFINED FUNCTION IN LINE 1'’0

or

10I4
FX A ’ ,’l

l ll'X ' *--1il|tf'^ ^*- •*•••

.!i. I'lnSiy' 5 j

*

’

.. . .; ,i %‘it^ .

i. -

i.nv.: ;jj!i((iiii^.;f -.;, ; ,'r • #*rrt ;

,

'

•}

^^ifr.t,'^, '<v* MV,)

k„-,j:^-I^1J4. .

. , -nil, p^ rt*

. “lanar : m^:,s#g"as^Aevssa.y

pft e. m'M. , ^iVn& >>}> f v^i,

'%4 !

L i Bli -

''

„

’*'.' P, ,.,

'' >?'6i

),V ' ifer'" ,

'

li&e -i.ik |?nlrV^( ,<'’f V f.* t(i .iO» ?',)ii. /r . f im

“

.jl'i

e

‘ »>( l«l %•,)' t*« |.,8i fc{» -

:'io 4*''

U<l# /‘O i V (ff 7r f3 . .* (- ft

.•,''i'^l»'vr4..i'i f«-.-

'X -\ ,

'

^ fL'"-':

.1 1 ^4.

‘ rV ' n,T , : '...i^kij^'/i' i ,;ti

,

'

' •' ,'U. , '' '^h v 5-

’ ’- *

> '.' 'V -i ' „ i», m

S

ir

'I: slit

.t'^‘

^ 'IGl»lji,l '__(' I I • W •/

J

'* • ‘. ^''1

, ' f MOf#l
141.0 TESTING THE STOP STATEMENT

The objective of this test is to verify that the implementation will

recognize the STOP statement in the course of executing a program (see

section 10 of BSR X3.60). Program execution must be terminated at that

point.

The test is structured to give two possible messages to the user. The

first message informs the user that after it, the execution of the test

should terminate. The user should consider the implementation to have passed

the test, if indeed -the program terminated. If the second message also

appears, then the implementation has ignored the STOP statement between the

two statements, without recognizing the STOP.

If the implementation passes the test, only the following message should

be printed:

IF PROGRAM EXECUTION TERMINATES AFTER THIS STATEMENT, THE STOP STATEMENT

FOR THIS SYSTEM WORKS.

However, should the ' mplementat ion fail the test, the following message

will also be printed;

PROGRAM EXECUTION WAS NOT TERMINATED, THEREFORE, THE SYSTEM HAS FAILED

THE TEST.

There is one point that must be made here. If the system under test

does not recognize STOP and does not provide a diagnostic or continue

execution by ignoring it, then the only way that a user can determine whether

STOP has been successful is by other system-related information being

provided after the execution of the program. For example, at the ordinary

termination of a program some systems may give execution time and then return

to the BASIC processor command mode. If the program halts on STOP without

without returning to the processor, then the user might be able to conclude

that the STOP statement was illegal in some form. At this point, though, the user should consult with the local system expert to determine that the halt

is not caused by some other source.

'kitititititititicititirifitifitit’kiclt * PROGRAM FILE 141 *

•kit'kit-k'k'kitit'k'kickit-k'k'k'k-k'k

0010 PRINT "PROGRAM

0020 PRINT

0030 PRINT

0040 PRINT

0110 PRINT " 0120 PRINT

SECTION 141.0 THE STOP STATEMENT."

106
0130 PRINT

0140 PRINT " BEGIN TEST,"

0150 PRINT

0160 PRINT " IF PROGRAM EXECUTION TERMINATES AFTER THIS STATEMENT,"

0170 PRINT "THE STOP STATEMENT FOR THIS SYSTEM WORKS."

0180 STOP

0190 PRINT " PROGRAM EXECUTION WAS NOT TERMINATED, THEREFORE, THE"

0200 PRINT "SYSTEM HAS FAILED THE TEST."

0210 PRINT

0220 PRINT " END TEST."

0230 PRINT

0240 END

'kifit-kic'ie-k'k-kieifif’k-kic-k-k * SAMPLE OUTPUT *

•k'k'k'kicif'kit-k-k'kicicic-k'k'k

PROGRAM FILE 141

SECTION 141.0 THE STOP STATEMENT.

BEGIN TEST.

IF PROGRAM EXECUTION

THE STOP STATEMENT FOR TH

TERMINATES AFTER

IS SYSTEM WORKS.

THIS STATEMENT,

107
142.0 END STATEMENT MUST BE THE LAST PROGRAM STATEMENT

This section tests the requirement that the END statement be physically

last in the program (see section 4 of BSPv. X3.60). We have introduced an END statement in line 130 and we expect that the system will provide a diagnostic pointing to line 130. This is a reasonable situation to diagnose

when one considers that several individual program sections might be written

and tested separately and combined into a larger program at a later time. An

END statement from one bf the modules might have been missed by the

programmer after joining the individual programs.

•k'kific'k'k'k'k'k'k'k'kit’k-kicicic'k'k * PROGRAM FILE 142 *

10 PRINT "PROGRAM FILE

20 PRINT

30 PRINT

40 PRINT

142"

50 PRINT " 60 PRINT

SECTION 142.0"

65 PRINT " 70 PRINT

END STATEMENT MUST BE LAST"

80 PRINT " 90 PRINT 1.0

100 GO TO 200

110 PRINT 3.0

120 GO TO 220

BEGIN TEST"

125 PRINT " END TEST"

130 END

200 PRINT 2.0

210 GO TO 110

220 PRINT 4.0

230 GO TO 125

240 END

* SAMPLE OUTPUT *

•kicif-kititicic-k'k-k'kiciticic-k

108
PEND IS NOT LAST IN LINE 130

•

. ’’.O' '.•)' *

A.

i

•V

! V(; ., .,.< 4 V ^ ! . • •' ' t*. ‘ V < •li'- *v» ••<••

t «•• 1 » yf/V ,r !' flt**" P'-

•• I ''f' ’• • rJ . 4 •,* ''.sVii. < -illV- W 'JwftfCl

,'i‘.

•

I "^.

»Vi 0

Iij4

i It 1 t) •itit'-

,. * < ,. .• • .

.( *»T

tki r

. ^.1 r'#t"

f

'

I

•'

' •' V

1 - •'

* *. ^ -

'

1 =< < t .> ( y; if

: .‘S.M %r- . 1

• 1 . > i "t* <!( . i>: a

ii'SKH M.

1 M ^ i

* .' .•> • ' » 31 • .,,

1 V 1 „ af'i

'• V

.• <i:.- '

.! '>v>.,4*lk rriJY^'t !• ?

:

I *f

-,r - .tm -k

:

-v^ • o.a V v»- uu

oJfrsiMi iH.Tr 4U'“ iti«v / ikfcwriWrt^ iMf ul^k. . i ' .{f

" ' ''

* ;rr.»y

.'

' "k_ '

' <i''

'.''',
t

143.0 A PROGRAM REQUIRES AN END STATEMENT

In this section we will test a simple program without an END statement

(see section 4 of BSR X3.60). The system should provide a diagnostic

for this situation. If it does not, the program will indicate that the test

fails.

’k'k'k-k'kicic’kit'k'kicisicicic-k-k'k-ic * PROGRAM FILE 143 *

k'k-kit'kic-k'kicicie-k’kieifit'k'kif-k

10 PRINT " 20 PRINT

30 PRINT

40 PRINT

50 PRINT " 55 PRINT

60 PRINT " 70 PRINT

80 PRINT " 90 PRINT " 100 PRINT

PROGRAM FILE 143"

SECTION 143.0"

PROGRAM REQUIRES AN END STATEMENT"

IF THIS STATEMENT APPEARS THE SYSTEM HAS NOT SCANNED AHEAD"

TO FIND THAT THERE IS NO END STATEMENT. IF THERE IS NO"

"DIAGNOSTIC INDICATING THIS THEN THE TEST HAS FAILED."

*****************

* SAMPLE OUTPUT *

icifiticicic'kititlcificicicic-kit

?END STATEMENT IS MISSING

110
144.0

COMPOUND EXPRESSIONS AS ARGUMENTS FOR ABS AND ATN

The objective of this test section is to determine whether the

implementation will let the argument of a function call be expressed in

various numerical expression144.1 forms (see sections 7 and 8 of BSR X3.60).

The ABS Function

This subtest takes an incremented approach in determining the kinds of

expressions allowed as the argument-list of a function reference. It begins

with expressions involving addition of terms and then advances through other

hierachical forms of operations which include the nesting of an ABS function

with an ABS function. On output, the test can give three types of output

messages to the user. First, should the implementation fail to correctly

evaluate any one of the expressions, an error message will be printed

indicating which expression failed. Second, there should be an overall error message to the user, if any expression failed to be evaluated properly.

Third, should the implementation not fail any of the evaluations, then the

message printed should inform the user that the implementation passed the

test

.

144.2

The ATN Function

This subtest is similar to section 144.1. However, in this case, the

ATN function is being used instead of ABS. The approach to testing the

correct evaluations of the expressions used as the arguments is the same. On

output, the format should follow the same pattern described in section 144.1.

'k^ic’k’k'kit-kit-k-kis-k’k-kic'ic-k-k'k * PROGRAM FILE 144 *

'k-k-k’k’k’k’k-kic-k'k-k'k'icic'k'k'kis'k

0010 PRINT "PROGRAM FILE 144"

0020 PRINT

0030 PRINT

0040 PRINT

0110 PRINT "SECTION 1 4 4 . 0 : COMPOUND

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT " 0170 PRINT

0180 PRINT " 0190 PRINT

0200 PRINT

0210 PRINT

EXPRESSIONS AS FUNCTION ARGUMENTS"

SECTION 144.1"

(THE ABS FUNCTION. )

111
0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

PRINT " BEGIN TEST."

PRINT

LET A1=0.

5

LET Bl=-.25

LET Cl=16.0

LET Dl=-4.0

LET P=1

LET E1=ABS (Al+BD+l. 0 LET F1=ABS (El- (0. 5-. 25) -1. 0)

LET E1=ABS (0. 0-ABS (Al-Cl+Dl)

)

LET G1=ABS (El+(0. 5-16.0-4. 0)

)

LET E1=ABS (Al+1. 0- (Cl+DD+0. 5*8. 0)

LET Hl=ABS (El+( 0.5) +1.0- (16. 0-4.0) +4.0)

LET E1=ABS (1. 0E0+(1. 0*1. 0/1. 0) “2)

LET I1=ABS (El-2.0)

LET E1=ABS (0-ABS (-5*l/5-5*ABS (-1) )

)

LET J1=ABS (El-6)

IF FK= lE-5 THEN 430

LET Rl=l

LET K=1

GOSUB 980

IF GK= lE-4 THEN 470

LET Rl=l

LET K=2

GOSUB 980

IF HK= lE-5 THEN 510

LET Rl=l

LET K=3

GOSUB 980

IF IK*lE-5 THEN 550

LET Rl«l

LET K»4

GOSUB 980

IF JK»lE-5 THEN 590

LET Rl»l

LET K«5

GOSUB 980

LET A$«" ABS " GOSUB 1080

PRINT

PRINT

PRINT

PRINT " PRINT

PRINT " PRINT

PRINT

PRINT

PRINT " PRINT

LET A1-. 175

LET Bl».

5

LET Cl —.6

LET D1-.3

LET P-1

LET El-ATN (B1*2+2*B1*D1+D1“2)

LET Fl-ABS (E1-. 569313)

SECTION 144.2"

(THE ATN FUNCTION.)"

BEGIN TEST."

112
fe)79tJ LET E1=ATN (Al+ABS (Cl) ) k)800 LET G1=ABS (E1-. 65931)

0810 LET E1=ATN (B1*ABS (-500)

)

0820 LET H1=ABS (El-1. 5668)

0830 IF FK= lE-6 THEN 870

0840 LET Rl=2

0850 LET K=1

0860 GOSUB 980

08"'0 IF GK= lE-6 THEN 910

0880 LET Rl=2

0890 LET K=2

0900 GOSUB 980

0910 IF HK= lE-5 THEN 950

0920 LET Rl=2

0930 LET K=3

0940 GOSUB 980

0950 LET A$=" ATN " 0960 GOSUB 1080

0970 GOTO 1170

0980 ON R1 GOTO 990,1010

0990 LET A$=" ABS " 1000 GOTO 1020

1010 LET A$=" ATN " 1020 PRINT "THE" ;A$ ; "FUNCTION FOR THIS SYSTEM HAS FAILED TO EVALUATE"

1030 PRINT "THE COMPOUND EXPRESSION ARGUMENT" ; K

; "THAT WAS REQUIRED OF"

1040 PRINT "IT."

1050 PRINT

1060 LET P=2

1070 RETURN

1080 ON P GOTO 1090,1120

1090 PRINT "THE SYSTEM PASSED THE" ;A$ ; "EVALUATION OF COMPOUND EXPRESS-"

1100 PRINT "IONS, AS ITS ARGUMENT."

1110 GOTO 1140

1120 PRINT "THE SYSTEM FAILED THE" ;A$ ; "EVALUATION OF COMPOUND EXPRESS-"

1130 PRINT "IONS, AS ITS ARGUMENT, BECAUSE OF THE ABOVE REASONS."

1140 PRINT

1150 PRINT " END TEST."

1160 RETURN

1170 PRINT

1180 END

'k'k-k-k'k'kicif'kiciticit'kis'kic * SAMPLE OUTPUT *

'kic'k'k-k’kic'kicit'kiciticit'kif

PROGRAM FILE 144

113
SECTION 144 . 0:COMPOUND EXPRESSIONS AS FUNCTION ARGUMENTS

SECTION 144.1

(THE ABS FUNCTION.)

BEGIN TEST.

THE SYSTEM PASSED THE ABS EVALUATION OF COMPOUND EXPRESSIONS, AS ITS ARGUMENT.

END TEST.

SECTION 144.2

(THE ATN FUNCTION.)

BEGIN TEST.

THE SYSTEM PASSED THE ATN EVALUATION OF COMPOUND EXPRESSIONS, AS ITS ARGUMENT.

END TEST.

lilt
145. k) COMPOUND EXPRESSIONS AS ARGUMENTS FOR COS AND EXP

145.1 The COS Function

This test is similar to section 144.1, except for the use of COS.

output, it uses the same formatted messages as described in 144.1.

145.2 The EXP function

This test is again similar to section 144.1 except for the use of

The output messages are also the same.

'kic'kic-kis'kit'k-k'kif'kitit-kic-k-kic * PROGRAM FILE 145 *

'k'k'kicicit'k'k-kicic-k-k'kit-k-kisit'k

0010

0020

0030

0040

0050

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

01‘70

0180

0190

0200

0210

0220

0230

0240

0250

0260

02''0

0280

0290

0300

0310

PRINT "PROGRAM FILE 145"

PRINT

PRINT

PRINT

PRINT "SECTION 14 5 . 0 : COMPOUND EXPRESSIONS AS ARGUMENTS"

PRINT

PRINT

PRINT

PRINT " SECTION 145.1"

PRINT

PRINT " (THE COS FUNCTION.)"

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Al=l.

0

LET Bl=2.

0

LET Cl=.

5

LET P=1

LET D1=C0S (Bl-2. 0*A1)

LET E1=ABS (Dl-1. 0)

LET Dl=COS (A1''2-2*A1*C1+C1"2)

LET F1=ABS (D1-. 968912)

LET D1=C0S (Al+Bl+6*C1)

LET G1=ABS (D1-. 96017)

IF EK= lE-5 THEN 310

LET Rl=l

LET K=1

GOSUB 820

IF FK= lE-6 THEN 350

On

EXP.

115
0 320

0 3 30

0 340

0 3 50

0 3 60

0 3 70

0 3 80

0 3 90

0 4 00

0 4 10

0 4 20

0 4 30

0 4 40

0 4 50

0 4 60

0 4 70

0 4 80

0 4 90

0 500

0 5 10

0 5 20

0 5 30

0 5 40

0 5 50

0 560

0 5 70

0 580

0 590

0 600

0 6 10

0 6 20

0 6 30

0 6 40

0 6 50

0 6 60

0 6 70

0 680

0 690

0 7 00

0 1 10

0 1 20

0 7 30

0 1 40

0 1 50

0 7 60

0 7 70

0 7 80

0 7 90

0 8 00

0 8 10

0 8 20

08 30

0 8 40

,) 8 50

0 8 60

0 8 70

0 8 80

LET Rl=l

LET K=2

GOSUB 820

IF GK= lE-6 THEN 390

LET Rl=l

LET K=3

GOSUB 820

LET A$ = " COS

GOSUB 920

PRINT

PRINT

PRINT

PRINT ' SECTION 145.2"

PRINT

PRINT " (THE EXP FUNCTION,)"

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Al=-16.

0

LET Bl=4.0

LET P=1

LET C1=EXP (3*B1+A1)

LET D1=ABS ( (Cl-1. 83156E-2) /I. 83156E-2)

LET C1=EXP (Bl''2-Al/2)

LET E1=ABS ( (Cl-2. 64891E10) /2. 64891E10)

LET C1=EXP (ABS (Al) +A1)

LET Fl=ABS (Cl-1. 0)

LET Cl=EXP(Bl+ABS (AD-4.0)

LET G1=ABS ((C1-. 888611E7)/. 88861 IE »)

IF Dl< = 5. 45983E-6 THEN 6"'0 LET Rl=2

LET K=1

GOSUB 820

IF El< = 3. 7'^514E-6 THEN '710 LET Rl=2

LET K=2

GOSUB 820

IF FK= lE-5 THEN 750

LET Rl=2

LET K=3

GOSUB 820

IF GK= 1, 12535E-6 THEN "'90 LET Rl=2

LET K=4

GOSUB 820

LET A$=" EXP " GOSUB 920

GOTO 1010

ON R1 GOTO 830,850

LET A$=" COS " GOTO 860

LET A$=" EXP " PRINT "THE" ;A$; "FUNCTION FOR THIS SYSTEM HAS FAILED TO EVALUATE"

PRINT "THE COMPOUND EXPRESSION ARGUMENT" ; K

; "THAT WAS REQUIRED OF"

PRINT "IT,"

116
0890 PRINT

0900 LET P=2

0910 RETURN

0920 ON P GOTO 930,960

0930 PRINT "THE SYSTEM PASSED THE

0940 PRINT "IONS , AS ITS ARGUMENT

0950 GOTO 980

0960 PRINT "THE SYSTEM FAILED THE

0970 PRINT "IONS , AS ITS ARGUMENT

0980 PRINT

0990 PRINT " 1000 RETURN

1010 PRINT

1020 END

;A$;

«• "EVALUATION OF COMPOUND EXPRESS

;A$; "EVALUATION OF COMPOUND EXPRESS

BECAUSE OF THE ABOVE REASONS.

END TEST."

'kificic'k’kic'kii-kic'kicit'kicif * SAMPLE OUTPUT *

icic-k-kisit'k'kic'kititic'k'k-k-k

PROGRAM FILE 145

SECTION 145. 0;COMPOUND EXPRESSIONS AS ARGUMENTS

SECTION 145.1

(THE COS FUNCTION.)

BEGIN TEST.

THE SYSTEM PASSED THE COS EVALUATION OF COMPOUND EXPRESSIONS, AS ITS ARGUMENT.

END TEST.

SECTION 145.2

(THE EXP FUNCTION.)

BEGIN TEST.

117
THE SYSTEM PASSED THE EXP EVALUATION OF COMPOUND EXPRESS

IONS, AS ITS ARGUMENT.

END TEST.

118
146.0 COMPOUND EXPRESSIONS AS ARGUMENTS FOR LOG AND SGN

146.1 The LOG Function

This test is similar to section 144.1 except for the use of the

function. The output messages are also the same. 146.2 The SGN Function

This test is similar to section 144.1 except for the use of the

function. The output messages are also the same.

'k'k'k'k'kit'kitic-k'kicit’k'kicic'k-k-k * PROGRAM FILE 146 *

k-kis'k-kit'k'k'kit-k’kicicitie'kitific

0010 PRINT "PROGRAM FILE 146"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT " 0100 PRINT

0110 PRINT " 0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT " 0160 PRINT

0170 LET Al=. 125

0180 LET Bl=5.0

0190 LET P=1

0200 LET Cl=LOG (Al/Bl)

0210 LET Dl=ABS (Cl-{-3. 68888)

)

0220 LET C1=L0G (Bl''3+4*A1)

0230 LET El=ABS (Cl-4. 83231)

0240 LET C1=L0G (EXP (ABS (-16) )

)

0250 LET F1=ABS (Cl-16)

0260 IF DK= lE-5 THEN 300

0270 LET Rl=l

0280 LET K=1

0290 GOSUB ’20

0300 IF EK= lE-5 THEN 340

0310 LET Rl=l

0320 LET K=2

0330 GOSUB 720

0340 IF FK= lE-4 THEN 380

0350 LET Rl=l

SECTION 146.1"

(THE LOG FUNCTION.)"

BEGIN TEST."

LOG

SGN

119
0360 LET K=3

k33'^0 GOSUB '20

0380 LET A$=" LOG " 0390 GOSUB 820

0400 PRINT

0410 PRINT

0420 PRINT

0430 PRINT " SECTION 146.2"

0440 PRINT

0450 PRINT " (THE SGN FUNCTION.)

0460 PRINT

0470 PRINT

0480 PRINT

0490 PRINT " BEGIN TEST."

0500 PRINT

0510 LET Al=2.

5

0520 LET Bl=-8.

2

0530 LET P=1

0540 LET C1=SGN ( (B1"2-A1'‘3) /Bl)

0550 LET D1=SGN (ABS (Bl) +B1)

0560 LET El=SGN (B1"2 + 2*B1*A1+A1''2)

0570 IF Cl=-1 THEN 610

0580 LET Rl=2

0590 LET K=1

0600 GOSUB ?20

0610 IF D1=0 THEN 650

0620 LET Rl=2

0630 LET K=2

0640 GOSUB ’20

0650 IF El=l THEN 690

0660 LET Rl=2

0670 LET K=3

0680 GOSUB 720

0690 LET A$=" SGN " 0700 GOSUB 820

0710 GOTO 910

0720 ON R1 GOTO '’30, ''50 0730 LET AS=" LOG " 0740 GOTO 760

0750 LET A$=" SGN " 0’’60 PRINT "THE" ;A$ ; "FUNCTION FOR THIS SYSTEM HAS FAILED TO EVALUATE"

0770 PRINT "THE COMPOUND EXPRESSION ARGUMENT" ; K

; "THAT WAS REQUIRED OF

0780 PRINT "IT."

0790 PRINT

0800 LET P=2

0810 RETURN

0820 ON P GOTO 830,860

0830 PRINT "THE SYSTEM PASSED THE" ;A$ ; "EVALUATION OF COMPOUND EXPRESS

0840 PRINT "IONS, AS ITS ARGUMENT."

0850 GOTO 880

0860 PRINT "THE SYSTEM PASSED THE" ;A$ ; "EVALUATION OF COMPOUND EXPRESS

0870 PRINT "IONS, AS ITS ARGUMENT, BECAUSE OF THE ABOVE REASONS."

0880 PRINT

0890 PRINT " END TEST."

0900 RETURN

0910 PRINT

0920 END

120
'kicic'k'k-k'k-k-k'k-k-k'k'k-k-kit * SAMPLE OUTPUT *

'kic'k-k'k-k'kicicic'k-k'kic-k-k-k

PROGRAM FILE 146

SECTION 146.1

(THE LOG FUNCTION.)

BEGIN TEST.

THE SYSTEM PASSED THE LOG EVALUATION OF COMPOUND EXPRESS

IONS, AS ITS ARGUMENT.

END TEST.

SECTION 146.2

(THE SGN FUNCTION.)

BEGIN TEST.

THE SYSTEM PASSED THE SGN EVALUATION OF COMPOUND EXPRESS

IONS, AS ITS ARGUMENT.

END TEST.

121
14'?. 0 COMPOUND EXPRESSIONS AS ARGUMENTS FOR SIN AND S^R

14'?.1 The SIN Function

This test is similar to section 144.1 except for the use of the

function. The output messages are also the same.

14'?. 2 The SijR Function

This test is similar to section 144.1 except for the use of the

function. The output messages ate also the same.

* PROGRAM FILE 14"? *

0010 PRINT "PROGRAM FILE 14'?"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT " 0100 PRINT

0110 PRINT " 0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT " 0160 PRINT

01"?0 LET Al = l . 0 0180 LET Bl=2.0

0190 LET Cl=.

5

0200 LET P=1

0210 LET Dl=SIN (Bl-2. 0*A1)

0220 LET E1=ABS (Dl-0 . 0)

0230 LET Dl=SIN (A1"2-2*A1*C1+C1'“2)

0240 LET F1=ABS (D1-. 24'?404 ) 0250 LET Dl=SIN (Al+Bl+6*C1)

0260 LET G1=ABS (Dl- (-. 2'?9415) ) 02'?0 IF EK= lE-6 THEN 310

0280 LET Rl=l

0290 LET K=1

0300 GOSUB ?70

0310 IF FK= lE-6 THEN 350

0320 LET Rl=l

0330 LET K=2

0340 GOSUB ?'?0 0350 IF GK= lE-6 THEN 390

SECTION 147.1"

(THE SIN FUNCTION.)

BEGIN TEST."

SIN

SQR

122
k)36ki LET Rl = l 0370 LET K=3

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0 500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0"'60

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

GOSUB ’70

LET A$=" SIN " GOSUB 8'^0 PRINT

PRINT

PRINT

PRINT " SECTION 147.2"

PRINT

PRINT " (THE SQR FUNCTION.)"

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET Al=64

LET Bl=16

LET Cl=. 25

LET P=1

LET Dl=SQR( (Al/16) "2+2*Al*Bl+(Bl-6) "2)

LET E1=ABS (Dl-46. 5188)

LET Dl=SQR(99. 5+SQR(ABS (-. 25) )

)

LET F1=ABS (Dl-10)

LET D1=SQR( (LOG (EXP (Al) ) ) “'2) LET G1=ABS (Dl-64)

IF EK= lE-4 THEN 660

LET Rl=2

LET K=1

GOSUB 770

IF FK=lE-4 THEN 700

LET Rl=2

LET K=2

GOSUB 770

IF GK= lE-4 THEN 740

LET Rl=2

LET K=3

GOSUB 770

LET A$=" SQR " GOSUB 870

GOTO 960

ON R1 GOTO "780,800

LET A$=" SIN " GOTO 810

LET A$=" SQR " PRINT "THE" ;A$; "FUNCTION FOR THIS SYSTEM HAS FAILED TO EVALUATE"

PRINT "THE COMPOUND EXPRESSION ARGUMENT" ; K

; "THAT WAS REQUIRED OF"

PRINT "IT."

PRINT

LET P=2

RETURN

ON P GOTO 880,910

PRINT "THE SYSTEM PASSED THE" ; A EVALUATION OF COMPOUND EXPRESSPRINT "IONS, AS ITS ARGUMENT."

GOTO 930

PRINT "THE SYSTEM FAILED THE" ;A$ ; "EVALUATION OF COMPOUND EXPRESSPRINT "IONS, AS ITS ARGUMENT, BECAUSE OF THE ABOVE REASONS."

123
0930 PRINT

0940 PRINT " END TEST."

0950 RETURN

0960 PRINT

0970 END

it'kiticif’kicic-k'kieicitit'k'kic * SAMPLE OUTPUT *

PROGRAM FILE 14"'

SECTION 14 ’.1

(THE SIN FUNCTION.)

BEGIN TEST.

THE SYSTEM PASSED THE SIN EVALUATION OF COMPOUND EXPRESS

IONS, AS ITS ARGUMENT.

END TEST.

SECTION 14’7.2

(THE SQR FUNCTION.

)

BEGIN TEST.

THE SYSTEM PASSED THE SQR EVALUATION OF COMPOUND EXPRESS

IONS, AS ITS ARGUMENT.

END TEST.

12h
148.0 COMPOUND EXPRESSIONS AS ARGUMENTS FOR TAN AND INT

148.1 The TAN Function

The test is similar to section 144.1 except for the use of the

function. The output messages are also the same. 148.2 The INT Function

The test is similar to section 144.1 except for the use of the

function. The output messages are also the same.

'k-kic-k'kic'k'kic'k'k-k'kk'kif A -kicif * PROGRAM FILE 148 * aaaaaaaaaaaaaaaaaaaa

0010

0020

0030

0040

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET Al

LET Bl

LET Cl

LET P = LET D1

LET El

LET Dl

LET Fl

LET Dl

LET G1

IF El<

LET Rl

LET K = GOSUB

IF Fl<

LET Rl

LET K = GOSUB

IF Gl<

"PROGRAM FILE 148“

" SECTION 148.1"

" (THE TAN FUNCTION.)"

" BEGIN TEST."

= 1.5

= .75

= . 25

1=TAN (A1''2-B1)

=ABS (Dl-14 . 1014

)

=TAN ( (SIN (Cl+5* (Bl/3) ) ) ''2+ (COS (Cl + 5* (Bl/3) ) )

'' 2

)

=ABS (Dl-1. 55''41)

=TAN (ATN ( . 815)

)

=ABS (D1-. 815)

=1E-4 then 310

= 1 1T00

=lE-5 THEN 350

= 1 2700

=lE-6 THEN 390

TAN

INT

125
0360 LET Rl=l

0370 LET K=3

0380 GOSUB 700

0390 LET A$=" TAN " 0400 GOSUB 800

0410 PRINT

0420 PRINT

0430 PRINT

0440 PRINT " SECTION 148.2"

0450 PRINT

0460 PRINT " (THE INT FUNCTION.)"

0470 PRINT

0480 PRINT

0490 PRINT

0500 PRINT " BEGIN TEST."

0510 PRINT

0520 LET Al=6.25

0530 LET Bl=-8.15

0540 LET P=1

0550 LET D1=INT (A1"3+3*A1~2*B1+3*A1*B1'2+B1~3)

0560 LET C1=ABS (Dl-{-7)

)

0570 LET D1 = INT (ABS (A1"3+3*A1"2*B1 + 3*A1*B1''2+B1''3) ) 0580 LET El=ABS(Dl-6)

0590 IF CK= lE-5 THEN 630

0600 LET Rl=2

0610 LET K=1

0620 GOSUB 700

0630 IF EK= lE-5 THEN 670

0640 LET Rl=2

0650 LET K=2

0660 GOSUB 700

0670 LET A$=" INT " 0680 GOSUB 800

0690 GOTO 890

0'700 ON R1 GOTO 710,730

0710 LET A$=" TAN " 0720 GOTO 740

0730 LET A$=" INT " 0740 PRINT "THE" ;A$; "FUNCTION FOR THIS SYSTEM HAS FAILED TO EVALUATE"

0750 PRINT "THE COMPOUND EXPRESSION ARGUMENT" ; K

; "THAT WAS REQUIRED OF

0760 PRINT "IT."

07-70 print

0780 LET P=2

0790 RETURN

0800 ON P GOTO 810,840

0810 PRINT "THE SYSTEM PASSED THE" ; A $

; " EVA LUATION OF COMPOUND EXPRESS

0820 PRINT "IONS, AS ITS ARGUMENT."

0830 GOTO 860

0840 PRINT "THE SYSTEM FAILED THE "; A EVALUATION OF COMPOUND EXPRESS

0850 PRINT "IONS, AS ITS ARGUMENT, BECAUSE OF THE ABOVE REASONS."

0860 PRINT

0870 PRINT " END TEST."

0880 RETURN

0890 PRINT

0900 END

126
'k^itidc-k'k-k'k'kic'kicic'kicit * SAMPLE OUTPUT *

•k’k'k'k-k'kieif'kic'k'kiciticitit

PROGRAM FILE 148

SECTION 148.1

(THE TAN FUNCTION.

)

BEGIN TEST.

THE SYSTEM PASSED THE TAN EVALUATION OF COMPOUND EXPRESS

IONS, AS ITS ARGUMENT.

END TEST.

SECTION 148.2

(THE INT FUNCTION.)

BEGIN TEST.

THE SYSTEM PASSED THE INT EVALUATION OF COMPOUND EXPRESS

IONS, AS ITS ARGUMENT.

END TEST.

127
149.0 COMPOUND EXPRESSIONS AS ARGUMENTS FOR A USER DEFINED FUNCTION

The test is similar to section 144.1 except for the use of a defined function FNA(X) in line 170 (see sections and 16 of

X3.60). The output messages are similar to those in section 144.1.

icicieititicic'k-kifkisitifkititieiiic * PROGRAM FILE 149 *

•k'kificitic’kitic-ic-kitic'kicit'kic'kit

0010 PRINT "PROGRAM FILE 149"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT " SECTION 149.0"

0100 PRINT

0110 PRINT " (THE DEF FUNCTION.)"

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT " BEGIN TEST."

0160 PRINT

0170 DEF FNA(X)=X3-1

0180 LET Al=1.6

0190 LET Bl=.

5

0200 Rl=l

0210 LET X=FNA (SIN (Al) +6*B1)

0220 LET X1=ABS ( (X-62.9'795)/62.9''95)

0230 LET X=FNA( (SIN (Bl) ) 2+(COS (Bl) ) 2+3)

0240 LET X2=ABS(X-63)

0250 LET X=FNA(ABS (B12-5*A1)+2*(L0G(EXP(B1) ) )

)

0260 LET X3=ABS (X-668. 922)

0270 IF XK=1. 58"782E-6 THEN 310

0280 LET Rl=2

0290 LET K=1

0300 GOSUB 400

0310 IF X2<=lE-4 THEN 350

0320 LET Rl=2

0330 LET K=2

0340 GOSUB 400

0350 IF X3<=lE-3 THEN 450

0360 LET Rl=2

0370 LET K=3

0380 GOSUB 400

0390 GOTO 450

0400 PRINT "THE DEF FUNCTION FOR THIS SYSTEM HAS FAILED TO EVALUATE"

0410 PRINT "THE COMPOUND EXPRESSION ARGUMENT" ; K

; "THAT WAS REQUIRED OF"

0420 PRINT "IT."

user BSR

128
0430 PRINT

0440 RETURN

0450 ON R1 GOTO 460,480

0460 LET A$=” PASSED " 0470 GOTO 490

0480 LET A$=" FAILED " 0490 PRINT "THE SYSTEM" ;A$ ; "THE DEF FUNCTION EVALUATION OF COMPOUND"

0500 PRINT "EXPRESSIONS, AS ITS ARGUMENT."

0510 PRINT

0520 PRINT " END TEST."

0530 PRINT

0540 END

'kic'kic’k'k'k'kif'k'kif^s'kic'k^ * SAMPLE OUTPUT * *****************

PROGRAM FILE 149

SECTION 149.0

(THE DEF FUNCTION.)

BEGIN TEST.

THE SYSTEM PASSED THE DEF FUNCTION EVALUATION OF COMPOUND

EXPRESSIONS, AS ITS ARGUMENT.

END TEST.

129
150.0

COMPOUND EXPRESSIONS USED AS PRINT ITEMS AND TAB ARGUMENTS

The objective

implementation will

print list as one of

function (see section

of this test section is to d

recognize a numeric expression

the separate print items or as the

12 of BSR X3. 60 ) .

eterm i ne when it

atg umen

whether

is placed

t of the

the

in a 150.1 TAB

Expressions As Print Items

This test prints four expressions. These include: (1) simple variables

and constants, (2) an intrinsic function evaluated at a compound expression,

(3) an expression that includes the sum of a function plus a variable; and

(4) a call to a user defined function. The output lies in two columns with

the first column being the expected output and the second giving the

implementation evaluations of the expressions.

150.2

Expressions As Arguments of TAB Calls

In this test three expressions are used as arguments for a TAB call. In

order to obtain correct output the system must round the value of the

expression after evaluation and the TAB to that column. If the evaluations

are all proper then an A should appear in column 3, under a column index

counter, a B should appear on the second row under the column indices in

column 6, and finally a C should appear in column 69 on the third row under

the indices.

* PROGRAM FILE 150 *

0010

0020

0030

0040

0090

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

"PROGRAM FILE 150"

"SECTION 150.0: AS THE PRINT ITEMS 0F A PRINT-LIST"

" SECTION 150.1"

" (AS PRINT ITEMS IN THE DIRECT SENSE.

BEGIN TEST."

II

130
0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

PRINT " TWO COLUMS OF NUMERALS SHOULD APPEAR BELOW THIS PARA-"

PRINT "GRAPH. IN COLUMN 1 ARE THE EXPECTED VALUES AND IN COLUMN 2"

PRINT "ARE THOSE VALUES WHICH THE PRINT STATEMENT OF THE SYSTEM"

PRINT "EVALUATED."

PRINT

DEF FNA(X)=X"2+1

LET Al=0.

5

LET Bl=-.25

LET Cl=16.

0

LET Dl=-4.0

PRINT "COLUMN 1", "COLUMN 2"

PRINT

PRINT "-.25 ",3*A1+7*B1

PRINT " 6.5 " ,ABS (Al+1. 0- (Cl+DD+0. 5*8. 0)

PRINT " 16.4794 " ,SIN (Al''2+ABS (Bl) ) +C1

PRINT " 1.54193 " , FNA (Bl+Al ) +S IN (Al

)

PRINT

PRINT "IF THE NUMERICAL VALUES OF EACH PAIR OF NUMERALS, FORMED BY"

PRINT "THE ROWS OF THE RESPECTIVE TWO COLUMN, ARE THE SAME, THEN"

PRINT "CONSIDER THE SYSTEM TO HAVE PASSED THE TEST."

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " SECTION 150.2"

PRINT

PRINT " (AS PRINT ITEMS IN THE INDIRECT SENSE, ARGUMENTS OF THE"

PRINT " TAB-CALL."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

DEF FNB (X)=X"3-8

LET Al=2.75

LET Bl=l.

5

LET Cl=3.1

PRINT "00000000011111111112222222222333333333344444444445";

PRINT "5555555556666666666777"

PRINT "12345678901234567890123456789012345678901234567890";

PRINT "1234567890123456789012"

PRINT TAB (2*C1-A1) ; "A"

PRINT TAB (2*ABS (-B1) +A1) ; "B"

PRINT TAB(FNB(A1+B1)-.15) ;"C"

PRINT

PRINT " IF THE ALPHABETS A, B, AND C ARE PRINTED IN COLUMNS 3,"

PRINT "6, AND 69 RESPECTIVELY, OF THE RESPECTIVE LINES OF WHICH"

PRINT "EACH ALPHABET IS PRINTED, THEN CONSIDER THE SYSTEM TO HAVE"

PRINT "PASSED THE TEST."

PRINT

PRINT " end test."

PRINT

END

131
’k-kicic-k'k'ic-k'k-kitic-k-k-kic-k * SAMPLE OUTPUT *

•k'k-k'k'k-k’kic'k'kitic'kif'k-k-k

PROGRAM FILE 150

SECTION 150.0: AS THE PRINT ITEMS 0F A PRINT-LIST

SECTION 150.1

(AS PRINT ITEMS IN THE DIRECT SENSE.)

BEGIN TEST.

TWO COLUMS OF NUMERALS SHOULD APPEAR BELOW THIS PARAGRAPH. IN COLUMN 1 ARE THE EXPECTED VALUES AND IN COLUMN 2 ARE THOSE VALUES WHICH THE PRINT STATEMENT OF THE SYSTEM

EVALUATED.

COLUMN 1

-. 25

6.5

16.4794

1.54193

COLUMN 2

-. 25

6.5

16.4794

1.54193

IF THE NUMERICAL VALUES OF EACH PAIR OF NUMERALS, FORMED BY

THE ROWS OF THE RESPECTIVE TWO COLUMN, ARE THE SAME, THEN

CONSIDER THE SYSTEM TO HAVE PASSED THE TEST.

END TEST.

SECTION 150.2

(AS PRINT ITEMS IN THE INDIRECT SENSE, ARGUMENTS OF THE

TAB -CALL.

BEGIN TEST.

00000000011111111112 222222222333333333344444444445555555555666666666677-v

1234567890123456789012345678901234 56'789012345678901234567890123456'789012

A

B

132
c

IF THE ALPHABETS A, B, AND C ARE PRINTED IN COLUMNS 3,

6, AND 69 RESPECTIVELY, OF THE RESPECTIVE LINES OF WHICH

EACH ALPHABET IS PRINTED, THEN CONSIDER THE SYSTEM TO HAVE

PASSED THE TEST.

END TEST.

133
151.0 COMPOUND EXPRESSIONS USED IN IF THEN STATEMENTS

This test verifies that the implementation will perform comparisons of

numerical expressions containing two or more terras (see section 10 of BSR

X3.60). The expressions involve function references as well as the

multiple terms. On output, should the implementation incorrectly evaluate

the comparison, there will be an error message for each incorrect comparison

as well as a final summary message concerning the errors. Should the

implementation correctly evaluate the expressions there will only appear a message indicating that the implementation passed the comparison test.

icis'k-k-kic-k-k-k-k-k-kit-kic'k'k'k-kit * PROGRAM FILE 151 *

itisit-k-k-kicit’kic’k'k'k'kic’kit'k-k'k

0010

0020

0030

0 0 4 0 0090

0100

0110

0120

0130

0140

0150

0160

01‘70

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

151.0: COMPOUND EXPRESSIONS

STATEMENTS.

BEGIN TEST.

PRINT "PROGRAM FILE 151"

PRINT

PRINT

PRINT

PRINT " SECTION

PRINT " PRINT

PRINT

PRINT

PRINT " PRINT

DEF FNA (X) =X‘'2 + 2*X + 1 LET Al=3.

5

LET B1=1.625

LET Cl=. 815

LET Dl=-4.

5

LET F=1

IF A1+BK6 THEN 250

LET K=1

GOSUB 410

IF 1>A1-ABS(D1) THEN 280

LET K=2

GOSUB 410

IF INT (SQR (ABS (Dl) )

) =2 THEN 310

LET K=3

GOSUB 410

IF FNA(A1)+5<=ABS (DD+Al"! THEN 340

LET K=4

GOSUB 410

IF EXP (Al) +D1>= (A1-. 36) "2+Dl THEN 3"’0 LET K=5

GOSUB 410

IF TAN (Cl ) +A10ATN (Cl ) +A1 THEN 450

IN IF-THEN"
k)3 80 LET K=6

0390 GOSUB 410

0400 GOTO 450

0410 PRINT "THE SYSTEM FAILED RELATIONAL EVALUATION NUMBER" ; K

0420 LET F=2

0430 PRINT

0440 RETURN

0450 ON F GOTO 460,490

0460 PRINT "THE SYSTEM PASSED THE RELATIONAL EVALUATION OF THE COMPOUND"

0470 PRINT "EXPRESSIONS AS USED IN THE IF-THEN STATEMENTS."

0480 GOTO 510

0490 PRINT "THE SYSTEM FAILED THE RELATIONAL EVALUATION OF THE COMPOUND"

0500 PRINT "EXPRESSIONS AS USED IN THE IF-THEN STATEMENTS."

0510 PRINT

0520 PRINT " END TEST."

0530 PRINT

0540 END

’kit-k-kic-k'k'kif'klc'kitit-kic'k * SAMPLE OUTPUT *

•kic’kit'kicic'k-k’k’k'kicicitic-k

PROGRAM FILE 151

SECTION 151.0: COMPOUND EXPRESSIONS IN IF-THEN

STATEMENTS.

BEGIN TEST,

THE SYSTEM PASSED THE RELATIONAL EVALUATION OF THE COMPOUND

EXPRESSIONS AS USED IN THE IF-THEN STATEMENTS.

END TEST,

135
152.0 COMPOUND EXPRESSIONS USED IN FOR - NEXT STATEMENTS

The objective of this test is to determine whether the implementation

will make proper evaluations when numeric expressions are used as the

parameters in a FOR - NEXT statement (see section 11 of BSR X3.60). In

fact the numeric expressions are used as the i ni t i al -val ue , the limit, and

the step-clause. On output, the test prints one of two possible output

messages to the user, i.e. either the system passes or it fails.

'k’k-k’k'k’kitic'k'kititic-k'kicicic-k-k * PROGRAM FILE 152 *

icic'kilititic'kic'k'kicic-k'k'k-k-kitie

0010

0020

0030

0040

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

03”70

0380

0390

PRINT "PROGRAM FILE 152"

PRINT

PRINT

PRINT

PRINT " SECTION 152.0: COMPOUND EXPRESSIONS USED IN FOR-NEXT"

PRINT " STATEMENTS."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET N=3

LET M=6

LET N (1 ) =10

LET M (1 ) =4

LET 0=-l

LET K=0

FOR I0=N TO M

FOR I1=N(1) TO M(l) STEP O

FOR I2=M' 2+2*M*M (1) "2 TO (N ( 1

) “ 3-1 ) +ABS (0 ) STEP 20*N(l)/2

FOR I3=ABS (M(l)-M) TO M(1)"2 -m''2 STEP 2 *SGN (M ( 1 ) ^ 2-M' 2 ) LET K=K+1

NEXT 13

NEXT 12

NEXT II

NEXT 10

IF K=2688 THEN 360

PRINT " THE SYSTEM FAILED TO EVALUATE THE COMPOUND EXPRESSIONS"

PRINT "IN A PROPER MANNER FOR IHE CORRECT NUMBER OF FOR-NEXT LOOP-"

PRINT "ING."

GOTO 390

PRINT " THE SYSTEM PASSED THE EVALUATION OF COMPOUND EXPRESS-"

PRINT "IONS BECAUSE THE PROPER NUMBER OF FOR-NEXT LOOPINGS WERE"

PRINT "PERFORMED."

PRINT

136
0400 PRINT " END TEST."

0410 PRINT

0420 END

'kicic'k’k'k'kit'k'k'k'k'kiticicit * SAMPLE OUTPUT *

•k'k'kif-k'kic-k’kicit-kifitit'k-k

PROGRAM FILE 152

SECTION 152.0: COMPOUND EXPRESSIONS USED IN FOR-NEXT

STATEMENTS.

BEGIN TEST.

THE SYSTEM PASSED THE EVALUATION OF COMPOUND EXPRESSIONS BECAUSE THE PROPER NUMBER OF FOR-NEXT LOOPINGS WERE

PERFORMED.

END TEST.

137
153-0 COMPOUND EXPRESSIONS USED IN SUBSCRIPTS

This section tests whether the implementation will accept compound

numeric expressions as subscripts to dimensioned variables (see section 6 of

BSR X3.60)’. In order to access the array variable however the system

must first evaluate the expression and then round the resulting value to the

nearest integer. For example, in this test there are four expressions that are used as subscripts in program lines 200, 260 and 320. In the first of

these lines, numbers were chosen in such a way that there should be no round-off problem. In the second expression, there is a need for the system

to round-down and in the final expression the system will have to round-up

plus evaluate another expression for a doubly dimensioned array. If any

evaluation fails, a message will point to the line in the program that failed

to evaluate properly. There is a final message indicating that the system

passed or failed.

•kisicic-k-kitit-kififit-kifif-kificicit * PROGRAM FILE 153 * kkkkkkkkkkkkkkkkkkkk

10

20

30

40

50

110

120

130

140

150

160

1'70 180

190

200

210

220

230

240

250

260

270

280

290

300

310

320

330

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET

LET

LET

LET

LET

LET

LET

IF

"PROGRAM FILE 153"

"SECTION 153. 0:COMPOUND EXPRESSIONS USED IN SUBSCRIPTS"

BEGIN TEST"

B{1) = 16

B(2) = 10

C(3,l) = 15

F = 0 X(l) = ^ A = -9

D = B((X(1) + ABS(A))/16) - 16

ABS(D) < lE-6 THEN 240

PRINT "EVALUATION ERROR IN PROGRAM I.INE 200"

LET F = 1 LET X(2) = 2.2

LET X(3) = 4.4

LET D = B(((2*X(2) + X(3))/8.8) - 9‘S1N(0) + 1.2) - 10

IF ABS(D) < lE-6 THEN 300

PRINT "EVALUATION ERROR IN PROGRAM LINE 260"

LET F = 1 LET Q3 = 3 LET X(4) = 2.T

LET D = C(((X(4) - U3) + 3)

IF ABS(D) < lE-6 THEN 360

(03 - 2)) - 15

138
340 PRINT "EVALUATION ERROR IN PROGRAM LINE 320"

350 LET F = 1 360 IF ABS(F) < 0.5 THEN 390

370 PRINT "COMPOUND EXPRESSIONS AS SUBSCRIPTS: FAILED

380 GO TO 400

390 PRINT "COMPOUND EXPRESSIONS AS SUBSCRIPTS: PASSED

400 PRINT

410 PRINT " END TEST"

420 END

**-k*-k*-k**:*-k ******

* SAMPLE OUTPUT *

'k'k'k'k'k'k'k'k'k-kific'kic-k-kit

PROGRAM FILE 153

SECTION 153. 0:COMPOUND EXPRESSIONS USED IN SUBSCRIPTS

BEGIN TEST

COMPOUND EXPRESSIONS AS SUBSCRIPTS: PASSED

END TEST

139
154.0 A COMPOUND EXPRESSION USED IN AN ON GOTO STATEMENT

In th

i

transfer s correctly,

transfer

.

indicating

s test, an ON - GOTO expression is evaluated with three

(see section 10 of BSR X3.60). If all transfers

then there will be three messages indicating each

If any transfer is made incorrectly, there will be

failure. The. test is passed if all transfers are correct

icic-kititit'k-k'k’k’k’k-k’kic’k'kifif-k * PROGRAM FILE 154 *

kic-k-k'kis'k'k’kic'kit'k’k-kitic^ic-k

10 PRINT "PROGRAM FILE 154"

15 PRINT

20 PRINT

25 PRINT

30 PRINT "SECTION 154.0: COMPOUND EXPRESSION USED IN AN ON - GOTO"

35 PRINT " STATEMENT"

40 PRINT

45 PRINT " BEGIN TEST"

50 PRINT

60 LET A = 3 65 LET B = 1 70 LET F = 0 75 FOR L = 0 TO 2 80 ON ( (L+SIN (0) *9) + ( (A/3) -1) ) +B GOTO 100, 200, 300

85 PRINT "SYSTEM FELL THROUGH ON - GOTO WHEN L = "

; L 90 STOP

100 LET F = 1 110IFL + F''1.5 THEN 140

120 PRINT "FIRST ON - GOTO TRANSFER CORRECT"

130 GO TO 400

140 PRINT "ON - GOTO TRANSFER "; L+1;" INCORRECT"

150 GO TO 400

200 LET F = 2 210 IF L+F < 2.5 THEN 250

220 IF L+F >3.5 THEN 250

230 PRINT "SECOND ON - GOTO TRANSFER CORRECT"

240 GO TO 400

250 PRINT "ON - GOTO TRANSFER" ; L+1 ; " INCORRECT"

260 GO TO 400

300 LET F = 3 310 IF L+F < 4.5 THEN 350

320 IF L+F > 5.5 THEN 350

330 PRINT "THIRD ON - GOTO TRANSFER CORRECT"

340 GO TO 400

350 PRINT "ON - GOTO TRANSFER" ; L+1 ; " INCORRECT"

400 NEXT L

possible

are made

correct

message
41k) PRINT

4 2k) PRINT •• END TEST**

43fc) END

'kic-kit-kie'kic’kick-k-k-k-AiK-k * SAMPLE OUTPUT *

PROGRAM FILE 154

SECTION 154. k); COMPOUND EXPRESSION USED IN AN ON - GOTO

STATEMENT

BEGIN TEST

FIRST ON - GOTO TRANSFER CORRECT

SECOND ON - GOTO TRANSFER CORRECT

THIRD ON - GOTO TRANSFER CORRECT

END TEST

l>il
155.0 COMPOUND EXPRESSIONS USING SUPPLIED FUNCTIONS

In this section we compute several

functions within them (see section 7 show that the compound expressions are evaluated and operations ordered

incorrectly a message will be printed indicating to

of that expression. Otherwise a single message

that the system passed.

expressions that involve the supplied

of BSR X3.60). The object is to

properly parsed, supplied functions

properly. If any expression is evaluated

the user the line number

to the user will indicate

'k'k'k-k-k'k'kif-kicisitif-kicititititic * PROGRAM FILE 155 *

•k'k'kicic-kitificitif-k-kic-k'kic'kifit

10 PRINT

20 PRINT

30 PRINT

40 PRINT

50 PRINT

60 PRINT

T0 PRINT

80 PRINT

90 PRINT " 100 PRINT

110 LET Cl

120 LET F 130 LET C2

140 IF ABS

150 PRINT

160 LET F 170 LET C3

180 IF ABS

190 PRINT

200 LET F 210 LET C4

220 IF ABS

230 PRINT

240 LET F 250 LET C5

260 IF ABS

270 PRINT

280 LET F 290 LET C6

300 IF ABS

310 PRINT

320 LET F 330 LET C7

340 IF ABS

'PROGRAM FILE 155"

'SECTION 155. 0:COMPOUND EXPRESSIONS USING SUPPLIED FUNCTIONS"

BEGIN TEST"

= 1.75

= 0 = L0G(EXP(C1) ) - 1.'75

(C2) < lE-6 THEN 1'70 "INCORRECT EVALUATION IN LINE 130"

= 1 = EXP (LOG (Cl) ) - 1. ’5

(C3) < lE-6 THEN 210

"INCORRECT EVALUATION IN LINE 170"

= 1 = (SIN(2.0))"2 + (COS(2.0))^2 - 1.0

(C4) < lE-6 THEN 250

"INCORRECT EVALUATION IN LINE 210"

= 1 = (1.0/COS (1. 2) ) '2 - ((S1N(1.2)/C0S(1.2))~2) - 1.0

(C5) < lE-6 THEN 290

"INCORRECT EVALUATION IN LINE 250"

= 1 = SIN(.78) - SUR(1.0 - (COS (0. ’8) ) "2)

(C6) < lE-6 THEN 330

"INCORRECT EVALUATION IN LINE 290"

= 1 = COS(1.5) - SQR(1.0 - (SIN (1. 5) ) ^2)

(C7) < lE-6 THEN 3'’0
350

360

370

380

390

400

410

420

430

440

450

460

470

480

490

500

510

550

PRINT "INCORRECT EVALUATION IN LINE 330'

LET F = 1 LET C8 = SQR( (1. 0/COS (0. 5236)

)

IF ABS(C8) < lE-6 THEN 410

PRINT "INCORRECT EVALUATION

LET F = 1 LET C9 = ATN (SIN (0. 5) /COS (0

IF ABS(C9) < lE-6 THEN 450

PRINT "INCORRECT EVALUATION

LET F = 1 IF ABS (F) < 0.5 THEN 480

PRINT "COMPOUND EXPRESSION

490

"COMPOUND

2 - 1.0) - (SIN (0. 5236) /COS (0. 5236)

)

IN LINE 370'

5)) - 0.5

IN LINE 410'

TEST FAILED"

GO TO

PRINT

PRINT

PRINT

PRINT

END

EXPRESSION TEST PASSED"

END TEST"

kic-k-kicicic-k-k-k-k-k-k-Aic-k-k * SAMPLE OUTPUT * kkkkkkkkkkkkkkkkk

PROGRAM FILE 155

SECTION 155. 0:COMPOUND EXPRESSIONS USING SUPPLIED FUNCTIONS

BEGIN TEST

COMPOUND EXPRESSION TEST PASSED

END TEST

ll+3

L
156.0 SEMANTIC ERROR—UPPER BOUND OF ARRAY SET TO ZERO WITH OPTION

If an option base statement specifies that

subscript is 1 then no dimension-statement

have upper bounds set to an incompatible dimension

the lower bound for an array

in the program may specify an The test for this

ill be

_ _ ^ , will

The system being tested should diagnose this as specifications, otherwise the test fails.

upper bound of zero (see section 15 of BSR X3.60).

specification is straightforward in that an option base specification w: set to 1 and two arrays, both a single and a double dimensioned array,

U\ V « I '« w-v V—S V- m ^ r-» r** /-v

'kisit'kif'kisit'kicitis'kicit-kicic'k'k * PROGRAM FILE 156 *

'k'kicicit'k'kititif'k'kicicilicicicicic

10 PRINT ' 20 PRINT

30 PRINT

40 PRINT

50 PRINT

60 PRINT

70 PRINT

80 PRINT

90 OPTION

100 DIM A

110 PRINT

120 PRINT

130 PRINT

140 PRINT

150 PRINT

160 PRINT

170 END

156"

'SECTION 156.0: SEMANTIC ERROR—UPPER BOUND OF ARRAY"

' SET TO ZERO WITH OPTION"

• BEGIN TEST."

"IF THIS MESSAGE APPEARS PRIOR TO TERMINATION THEN"

"THE SYSTEM HAS FAILED TO DIAGNOSE AN INCOMPATIBILITY"

"BETWEEN THE OPTION AND DIM STATEMENTS. THE TEST SYSTEM"

" FAILS.

" END TEST."

* SAMPLE OUTPUT * *****************

VDIMENSIONED ARRAYS OUT OF BOUNDS IN LINE 100
157. k) SEMANTIC ERROR —MULTIPLE OPTION STATEMENTS

A program may contain at most one option-statement (see section 15.4 of

BSR X3.60)

.

An arbitrary p r og r am may f ail to sa tisfy this requi rement

if/ for example, it had been crea ted f rom two separate programs each with

opt i on specif icati on molded togethe r as one program. The test system must

have the capability of d iagnosing that mul tipi e option statements appear i n a prog ram . This err or is included i n t he test program below and a diagnostic

,

othe r w i

;

se the test sys tern fails-

'k’kit'kicit’kit-k'kicic-kif'kicifii'kif * PROGRAM FILE 157 *

•k’k-kis’kisig'k'k'klt-k-k-k-kicicic-klt

10 PRINT "PROGRAM FILE 157"

20 PRINT

30 PRINT

40 PRINT

50 PRINT "SECTION 157.0: SEMANTIC ERROR—MULTIPLE OPTION STATEMENTS

60 PRINT

70 PRINT " BEGIN TEST."

80 OPTION BASE 1 90 DIM A(30)

100 OPTION BASE 0 110 DIM B{1,20)

120 PRINT "IF THIS STATEMENT APPEARS THEN THE TEST SYSTEM FAILED"

130 PRINT "TO DIAGNOSE TWO OPTION STATEMENTS IN LINES 80 AND 100."

140 PRINT

150 PRINT " END TEST."

160 END

kic-k'k'k'k'kicic’k'k'k'kitic-k-k * SAMPLE OUTPUT *

'k-k-k-k-k’kic'k-kic’k-kicic-kic-k

7MULTIPLE OPTION STATEMENT AT LINE 100
158,0 SEMANTIC ERROR—OPTION STATEMENT AFTER ARRAY REFERENCE

If an option-statement is present

lower numbered line than any dimen

(see section 15.4 of BSR X3.60).

analysis in which both implicitly and

before an option-statement. The 1 diagnostic and terminate execution in

in a program then it must occur in a

s ion-statement or reference to an array

This test is a straightforward case

an explicitly dimensioned arrays appear

anguage processor should provide a order to pass this test.

'k'k'k-k'kit'k'k'k'kif'kis-k'k'k-kit-kic * PROGRAM FILE 158 *

'kic’k'kificif'kitififiticicitititicitie

10

20

30

40

50

60

70

80

90

100

110

120

130

140

145

150

160

1‘70 180

190

200

210

'SECTION 158.0:

PRINT "PROGRAM FILE 158"

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT " DIM A(20) ,B (5, 20)

LET A (5) =1

LET B(4,15)=A{5)+9

LET C (10) =5

LET D(5,5)=C(10)+B(4,15)-15

PRINT D(5,5)

GOTO 160

OPTION BASE 1

SEMANTIC ERROR—OPTION STATEMENT AFTER"

ARRAY REFERENCE"

BEGIN TEST."

PRINT

PRINT

PRINT

PRINT

PRINT

END

'IF A ZERO APPEARS ABOVE THIS LINE THE SYSTEM FAILED TO"

'DIAGNOSE THAT THE OPTION-STATEMENT WAS OUT OF ORDER."

' END TEST."

’k’k’k-k-kititltificiiicif-k’kit-k * SAMPLE OUTPUT *

•k’k'k'k’k'k'kit'k'kiclf'k'kicitit

1U6
3

?ILLEGAL PLACEMENT OF OPTION IN LINE 150

i). S y,r '1

'

mj t%i{.q a) "/

. I u ' •« -ID

- '• V* .1) f.c r .lio*. T'"'. I <ortJ'' * i ifir'rtfti li • '-vii

. A *' t * 4 4 Jl i « #'i' 4 • •' I. 4 • t * 951 ,1.1*. '- •4|\HOOJ'

.

rar St*

. W Pm,Hi

‘‘M m

3f

fl

> I ' TU ,')iH ' ' ^ 30i MijJTA>«A40da y. H«; jiT»',,''r,JAa is t.'i j'njri*; *

1 ' ft PMlRt . ’

f

.'

l.iMI OJ% flfft#

Ilf • m ¥1^.

lliJP^IStT

’ l4*„>‘vrBr

• IN

. - • lU' (

1 1. ..-^3'fftTk ritt"' A% .tfi'Alj'M w)>(

* TWitPi w'

*. tJ1 *»V

'¥5- .t^Va T3.1 (i»<; 'HUi'* Nil

4 ‘ f N!i< •¥V . 'It'. wn j 'iHMMlO 'fiff i: VrliTt .i;» A ;i» 041»% Tt:;t '< ilti'VAl* ^,ftvp,,¥i" (jti

..:»r

i.ffA-*- m?" i'»*i.m. fi«i u./A.T< T«tv>‘ W'.u

#"4, 4*.lk^4f*4it«'44t <1 'Hj’i’i'yo 44MH.' ' '

I-4NV IN

rV

::.A . -.1 il'

ICt

Ef

it-
159. fc) SEMANTIC ERROR—ARRAY DECLARATION OUT OF PLACE

If a specific declaration by a dimension statement is made

then this declaration must appear in a lower numbered line tnat

to an element of that array (see section 15.4 of BSR X3.60).

for this requirement is straightforward in that arrays are their dimensioning statement is written. In order to pass, the

must produce a diagnostic that identifies this error.

for an array

any reference

The test

used prior to

test system

-k’k'kit'kicic-k-k'kicitic-kisit'k-kit'k * PROGRAM FILE 159 *

•kitit'k-k-kit'kitit-k-kic'kitit'kitltit

10 PRINT "PROGRAM FILE 159"

20 PRINT

30 PRINT

40 PRINT

50 PRINT "SECTION 159.0: SEMANTIC ERROR—ARRAY DECLARATION OUT OF PLACE"

60 PRINT

70 PRINT " BEGIN TEST."

80 PRINT

90 LET A(5)=l

100 LET B (5, 5) =A (5) +9

110 PRINT B (5, 5)

120 GOTO 140

130 DIMENSION A ( 30 ) , B ( 1 0 , 20

)

140 PRINT "IF THIS STATEMENT APPEARS PRECEDED BY A 10 THEN"

150 PRINT "THE SYSTEM FAILED TO RECOGNIZE THE DIMENSION STATEMENT"

160 PRINT "OUT OF PLACE."

1'70 PRINT

180 PRINT " END TEST."

190 END

ic’k'kic’k’k-k^cif’k'k-kiiicit'k'k * SAMPLE OUTPUT *

•k'kit'k-k’k-k-k-k'k-kicii^'k’k-k

7DIMENSI0N STATEMENT OUT OF PLACE LINE 130
160.0 SEMANTIC ERROR—DIMENSIONING AN ARRAY MORE THAN ONCE

If an array is dimensioned explicitly in a program then it can dimensioned only once (see section 15.4 of BSR X3.60). The test

this is straightforward. An array will be dimensioned twice. This seman

error requires a diagnostic from the test system in order to pass.

•k'kicic-k-icifit-k-k'kicic'kit-kitis'k-k * PROGRAM FILE 160 *

'k’k-k'k'k'k'k-kit-k'kiiit'kAkitk-k-k

10 PRINT "PROGRAM

20 PRINT

30 PRINT

40 PRINT

50 PRINT "SECTION

60 PRINT " 70 PRINT

80 PRINT " 90 DIM A(25) ,B (30,

100 DIM C (10, 20) ,A

110 PRINT "IF THIS

120 PRINT "RECOGNI

130 PRINT "90."

140 PRINT

150 PRINT " 160 END

FILE 160"

160.0; SEMANTIC ERROR —DIMENSIONING AN ARRAY

THAN ONCE"

BEGIN TEST."

10 ) (30)

MESSAGE APPEARS THE TEST SYSTEM FAILED TO"

ZE DOUBLE DIMENSIONING IN LINES 80 AND"

END TEST.

MORE"

'k'k'ktiic'k-k-kk-kk'kk'kk-kk * SAMPLE OUTPUT *

k'k'k’k’k-kk'kic'k'kick'kk-k-k

ll)9

be

for

tic

?DIMENSION ERROR LINE 90
161.0 INITIALIZING STRING VARIABLES

For string variables there are three commonly used alternatives for

associating implementation-defined initial values with string variables.

First, an unknown or arbitrary value moght be assigned. Second, the null

string might be assigned. Third, all string variables might be detectably

undefined in the sense that an exception will result from an attempt to

access the variable before that variable is explicitly assigned a value. The

American National Standard for Minimal BASIC recommends the third

alternative.

In the test below three unassigned string variables are printed. If the

values printed are all null then the system probably implements the second

alternative. If the values are somewhat arbitrary strings then alternative

one has been implemented. In either of these cases the test system fails the

standard recommendation. If the test system identifies the lines involving

undefined string variables and then terminates it satisfies the

reocmmendation.

'kit'kit'kitititifitif-kitific’kisitilic * PROGRAM FILE 161 *

it’kitititisicit-k-kititifisic-kitis'k'k

10 :PRINT ' 20 ,PRINT

30 PRINT

40 PRINT

50 PRINT ' 60 PRINT

70 PRINT ' 80 PRINT

90 PRINT

100 PRINT

110 PRINT

120 PRINT

130 PRINT

140 PRINT

150 PRINT

160 PRINT

170 PRINT

180 PRINT

190 PRINT

200 PRINT

210 PRINT

220 PRINT

230 PRINT

240 END

PROGRAM FILE 161"

SECTION 161.0: INITIALIZING STRING VARIABLES"

BEGIN TEST."

THREE STRING VARIABLES ARE PRINTED BELOW AFTER"

"EACH = SIGN"

"A$ = "B$ = "C$ =

";A$

";B$

";C$

"IF ALL STRINGS ARE NULL THEN SYSTEM PROBABLY INITIALIZES"

"STRING VARIABLES AS NULL STRINGS."

"IF SOMEWHAT ARBITRARY STRINGS ARE PRINTED THEN THE SYSTEM

"PROBABLY INITIALIZES STRING VARIABLES RANDOMLY."

"IN EITHER CASE THE SYSTEM FAILS THE STANDARD"

" RECOMMENDATION.

END TEST.

It
ic-k'k-k'k'kifif’k-k-k-kicicick'k * SAMPLE OUTPUT

'k-k'k-kic-k-k'k-k-k’k-kicif-k

7UNINITIALI

7UNINITIALI

7UNINITIALI

ZED VARIABLE

ZED VARIABLE

ZED VARIABLE

IN LINE 120

IN LINE 130

IN LINE 140

*

151
NBS-114A (REV. 7-73)

U.S. DEPT. OF COMM. BIBLIOGRAPHIC DATA

SHEET

1. PUBLICATION OR REPORT NO. NBSIR 78-1A20-4

2. Gov*t Accession

No.

3. Recipient’s Accession No.

4. TITLE AND SUBTITLE NBS Minimal BASIC Test Programs - Version 1 User's Manual

Vol . 4 - Mathematical and User Defined Functions,

Compound Expressions ^

5. Publication Date January 1978

6. Perlorming Organization Code

7. AUTHOR(S)

David E. Gilsinn, Charles L. Sheppard

8. Performing Organ. Report No.

9. PERFORMING ORGANIZATION NAME AND ADDRESS

NATIONAL BUREAU OF STANDARDS

DEPARTMENT OF COMMERCE

WASHINGTON, D.C. 20234

10. Project/TasL/Work Unit No, 640 1121

n. Contract/Grant No.

12. Sponsoring Organization Name and Complete Address (Street, City, State, ZIP)

National Bureau of Standards

Department of Commerce

Washington, DC 20234

13. Type of Report & Period Covered Final

14. Sponsoring Agency Code

15. SUPPLEMENTARY NOTES

16. ABSTRACT (A 200-word or less (actual summary of most sj^i7jcan( information. If document includes a significant bibliography or literature survey, mention it here.)

This volume is the fourth of four volumes that comprise the user's guide

to the NBS Minimal BASIC test programs. They test whether a BASIC processor

accepts the syntactical forms and produces semantically meaningful results

according to the specifications given in BSR X3.60 Proposed American National

Standard for Minimal BASIC . The programs in this volume Include: mathematical

function tests; exception tests for some of the functions; a statistical test of the uniformness of the random number generator; user defined function tests; syntax tests on the functions; tests using compound arithmetic expressions and

certain semantic tests on arrays and variable initialization. The entire set of test programs is available on magnetic tape.

17. KEY WORDS (six to twelve entries; alphabetical order; capitalize only the first letter of the first key word unless a proper name; separated by semicolons)

BAoICj BASIC stdnddrd; BASIC vdllddtlon; compiler Vdliddtlon; computer proQrdmming

language; computer standards

18. AVAILABILITY I

' Unlimited

For Official Distribution. Do Not Release to NTIS

I

^ Order From Sup. of Doc., U.S. Government Printing Office Washington, D.C. 20402, SD Cat. No. C I 3

Order From National Technical Information Service (NTIS)

Springfield, Virginia 22151

19. SECURITY CLASS

(THIS REPORT)

UNCLASSIFIED

20. SECURITY CLASS

(THIS PAGE)

LINCLASSIITED

21. NO. OF PAGES

160

22. Price

USCOMM-OC 2S042-PT4

I

\
I !i


mJ: .IK’'