NBSIR 78-1420-2 fL

NBS Minimal BASIC Test

Programs - Version 1

User's Manual

Volume 2 - General Program Structure, Output, Assignment,

Simple Control Structures, Simple 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-2

NBS MINIMAL BASIC TEST

PROGRAMS - VERSION 1 USER'S MANUAL

Volume 2 - General Program Structure, Output, Assignment,

Simple Control Structures, Simple Expressions

David E. Gilsmn

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 second of four volumes that comprise the user's guide

to the NBS Minimal BASIC test programs. The programs test whether a BASIC

processor accepts the syntactical forms and produces semantically meaningful

results according to the specifications given in BSR X3.60 Proposed Amer ican

National Standard for Minimal BASIC . The object of this volume is to

introduce elementary var iable , control and expression forms and exercise them

by using a large sample of variations of the appropriate statements. There

are thirty three programs in this volume. They cover specifically the tests

for output, simple assignment of variables, elementary control structures,

general program structure, formulating simple expressions, and the hierarchy

of operators. The entire set of test programs is available on magnetic tape.

Key Words: BASIC, BASIC standard, BASIC validation,

computer programming language, computer standards.

compiler validation,
TABLE OF CONTENTS

Page

0 . Introduction i

1 . Output and Assignment of Strings 2 Program Listing 1, Sample Output 3

2 . Exception Test for Printing TAB Beyond the Left

Margin 12

Program Listing 12

Sample Output 73

3 . Using Empty Print Items to Space Over Print

Zones 15

Program Listing 15

Sample Output 28

4 . Printing Integer and Fixed Point Constants ... 27

Program Listing 20

Sample Output 23

5 . Printing Floating Point Constants 2 6 Program Listing 27

Sample Output 3!

6. Printing of Floating Point Numbers (cont.) and

Assignment of Integer and Fixed Point Values . 35

Program Listing 38

Sample Output 42

7 . Assignment of Floating Point Constants 45

Program Listing 45

Sample Output 43

8. Testing the Minimal Limits in Magnitude of

Numerical Constants .' 5!

Program Listing 52

Sample Output 58

9 . The REM and GOTO Statements 80

Program Listing 82

Sample Output 84

10 . Test for GOTO with Illegal Statement

Label 86

Program Listing 86

Sample Output 87

11 . The IF-THEN Statement Used to Compare Positive

Numerical Constants 88

Program Listing j 0 Sample Output 74

lii
12 . The IF-THEN Statement Used to Compare Negative

Numerical Constants 76

Program Listing 77

Sample Output 81

13 . IF-THEN Comparison of Negative Constant

(cont.) and Variables Avoiding Parentheses 82

Program Listing 82

Sample Output 83

14 . Comparing Quoted Strings and String Variables . 84

Program Listing 85

Sample Output 90

15 . Test of IF-THEN Transfer to Illegal Line

Number 91

Program Listing 91

Sample Output 91

16 . Line Labels With and Without Leading Zeroes . . 93

Program Listing 93

Sample Output 94

17 . Order of Lines - Two Lines with the

Same Line Number 95

Program Listing 95

Sample Output . 96

18 . Order of Lines - Lines Out of

Order 97

Program Listing 97

Sample Output 97

19 . The ABS Function and Elementary Numerical

Expressions using Constants 99

Program Listing 100

Sample Output 104

20 . Elementary Numerical Expressions Using

Constants (Continued) 107

Program Listing 107

Sample Output HO

21 . Elementary Numerical Expressions Using

Constants (Continued) H3

Program Listing H3

Sample Output Hg

22 . Elementary Expressions Using Simple Variables . 119

Program Listing H9

Sample Output 122

23 . Elementary Expressions Using Simple Variables

(Continued) 125

Program Listing 125

Sample Output 130

IV
24 . Elementary Operations on Mixed Type Constants . 133

Program Listing ..... 133

Sample Output 136

25 . Elementary Operations on Mixed Type Constants

(Continued) 139

Program Listing 139

Sample Output 114

26 . Elementary Operations on Variables Assigned

Mixed Type Constants 127

Program Listing 2.I7 Sample Output 152

27 . Elementary Operations on Variables Assigned

Mixed Type Constants (Continued) 15I

Program Listing 152

Sample Output 160

28 . Addition of Three or More Terms 163

Program Listing 163

Sample Output 166

29 . Multiplication of Three or More Factors .... 168

Program Listing 168

Sample Output 171

30 . Hierarchy of Operators and Parentheses .... 273

Program Listing

Sample Output 1^8

31 . Hierarchy of Operators and Parentheses

(Continued)

Program Listing 181

Sample Output 185

32 . Evaluation of Expressions Having a Variety of

Operators 188

Program Listing 188

Sample Output

33 . Insertion of Spaces Between Elements of Numeric

Expressions 1^ 3 Program Listing -,^2

Sample Output -^2

v

0.0 Introduction

This volume is the second in a set of four volumes that comprise the

user's guide to the MBS Minimal BASIC test programs. There are thirty three

routines in this volume that cover the topics of output, simple assignment of

variables, some preliminary control structures, general program structure,

formulating simple expressions and determining the hierarchy of operators.

The user should be familiar with volume 1 of this series before executing the

programs because it describes the general system logic and environmental

assumptions made by the authors. Furthermore, in order to understand the

terminology, the user should also be familiar with the Minimal BASIC standard

BSR X3.60.

Except for routines that concentrate on evaluating processor diagnostic

capabilities, most routines have more than one individual test within them.

These tests are delineated within the body of the routine by a BEGIN TEST

statement on input and are terminated by an END TEST statement on output.

Each of the individual tests has been titled with a section number in its

program listing that identifies it with the appropriate documentation

section

The authors, in using the tests themselves, have found it useful to

proceed by first reading the test documentation paragraphs and noting the

appropriate sections within the standard that are covered by them. This

correspondence can be found in the overview volume. Next execute a program

file and compare the results with the sample output. Then, proceed with the

next routine. This allows orderly progression from one test to the next,

with the user keeping track of discrepancies as they occur. There is one source code for each major section in the

(e.g. 1.0, 2.0, etc.). The subsections (e.g. 1.2.1,

descriptive paragraphs of specific tests within the one associated with the major section. For example, there is a code NBS FILE 1 that is subtitled with a subsection number 1.2

that portion of the code is associated with subsection

document ion

documentat i on

2.2, etc.) are source code

portion of the

1. This means

1.2.1 in the

Within this and the subsequent volumes we have used the word "type" not

in the sense of a variable type but in the sense of a difference in form.

Thus we speak of one type of numerical constant over another in order to

differentiate say between an integer or "E" format numerical constant. Our use of the word "type" does not imply different compiler representation.

1
1.0

OUTPUT AND ASSIGNMENT OF STRINGS

This test unit executes some of the basic print-list forms which use such print-items as quoted strings, string variables, tab-calls, and nulls.

The test unit also executes the case of an empty-print-list. This section

uses specifications from sections 3, 4, 5, 6, 9, and 12 of the Minimal BASIC

standard X3.60.

1.1

An Empty Print List

The objective of this test is to verify that a completely empty

print-list will generate an end-of-pr int-1 ine , thereby completing the current

line of output. That is, if a PRINT statement contains no print list, then a blank line results. The test generates the empty print-list by following the

keyword PRINT with an end-of-line character. The output informs the user where the blank lines should be.

1.2

Printing and Assigning Quoted Strings

1.2.1 Allowed ASCII Characters

The objective of this test is to print the character set for BASIC which

is described in terms of the ASCII character set. The letters are the set of

upper-case Roman letters referenced by the ASCII character set in positions

4/1 through 5/10. The digits are the set of Arabic digits referenc =*d by the

ASCII character set in positions 3/0 through 3/9. The remaining

string-characters consist of: space, exclamation-point, quote, number-sign,

dollar, percent, ampersand, apostrophe, open-parenthesis, close-parenthesis,

asterisk, plus, comma, minus, period, slant, colon, semicolon, less-than,

equals, gr eater-than , question-mark, circumflex, and underline. The output

should show the letters first, then the digits and finally the remaining

quoted string-characters.

1.2.2

Spaces in Quoted Strings

The objective of this test is to show that an implementation will not

ignore spaces embedded in quoted strings. The output of the test illustrates

this by two lines of alphabetically ordered letters. As a comparison to show

that the embedded spaces were retained, the second line has blank spaces

where the letters B, E, F, I, J, K, N, 0, P, Q, T, U, V, W, and X should be.

1.2.3

End-of-Line Test for Quoted Strings

This test determines whether omitting the print-separator at the end of

a print-list will be recognized as an indicator to start the next-line. That

is, an end- of-pr i nt-1 ine should be generated and added to the characters

generated by the evaluation of the print-list. The test is constructed to

inform the user how each printed statement should begin and which lines

should be blank as a result of an empty string or a null-print.

1.2.4

Semicolon Separator for Quoted Strings

2
The objective of this test is to verify

semicolon separator generates the null st

length) . The test generates as output the dig

lines. To generate the five lines, the test i (1) one print item followed by no separator,

(2) three print items separated by semicolons

(3) two print items separated by a semicolon

different lines,

( 4 ) two print items separated by a semicolon

different lines, with different string 1 (5) three separate print statements

separated by semicolons.

that the evaluation of the

ring (i.e. a string of zero

its "123" on five successive

s constructed to perform:

on one line,

on but on engths from ( 3 )

,

1.2.5

Printing 72 Characters

The objective of this test is to verify that up to 72 characters may be

printed on one line. Since the total length of program lines, including the

keyword, has been limited to 72 characters, it is not possible to create a single 72-character output string. Therefore, the test uses the semicolon

separator to concatenate two sets of two strings each. The first string of

each set has 50 characters and the second has 22 characters. On output the

two lines of digits form column indices from 1 to 72. This test, of course,

assumes the availability of a 72 column output device or terminal.

1.2.6

Comma Separator for Quoted Strings

The objective of this test is to verify that comma separators generate

enough spaces to fill out the current print zone. The length of each zone is

implementation dependent but should have a width of at least d+e+6 spaces,

where d is the significance-width, and e is the exrad-width (see section 12.4

of BSR X3.60 ). All the print zones should have the same length, except

possibly the last. The number of zones and length is implementation

dependent. The test is constructed to output three sets of three letters XYZ

which should appear in a consistently spaced periodic manner. Each triplet

of letters should be separated by spaces and appear in separate print zones. The numbers printed above the letters specify print columns, and the

difference between the column number of one of the letters, say X, and its

next appearance on the line is the zone width. This number should be greater

than or equal to d+e+6. The difference between the column number of the

second and third X's should be the same as the first zone width. Three

groups were used in order not to exceed the 72 character maximum output line

for some implementations.

1.2.7

Tabbing Quoted Strings Within the Margin

The objec

columnar posi

printing the n in this test,

of characters

"margin" is

defined by the

is the print

that line. Pr

tive of this test is to show that TAB-calling will set the

tion of the current line to the specified value prior to

ext print-item. The TAB-calls are not made beyond the margin

The term "current line" refers to the (possibly empty) string

generated since the last end-of-pr i nt-1 i ne was generated. The

the number of characters that can be printed on one line and is

implementation. The "columnar position" of the current line

position that will be occupied by the next character output to

int positions are numbered consecutively from left to right,

3
starting with position one. The test uses the semicolon print-separator in

the print-list to effect the generating of the null string. The test output

begins by printing a string of digits for counting the columnar positions.

This string of digits should then be followed by the printing of the digits

1, 2, and 3 on three different consecutive lines. Each of the digits should

be printed in columns 24, 48, and 72, respectively. 1.2.8

Assignment of Quoted Strings

The objective of this test is to verify the assignment of strings to

string variables by assignments of the maximum assignable string length for a standard conforming program (18 characters). The test prints a phrase of 18

characters in length as a verification that the assignment of the maximum

assignable string length in a standard conforming program is possible for all

str i ng-var iables

.

1.2.9

Semicolon Separator for Assigned Strings

This test is similar to test 1.2.4. For this test the print-items in

the print-list are assigned to string-variables. The output should be the same as that in test 1.2.4.

1.2.10

Comma Separator for Assigned Strings

This test is similar to test 1.2.6. For this test the print-items in

the print-list are assigned to string-variables. The output should be the same as that in test 1.2.6.

1.2.11

Tabbing Assigned Strings Within the Margin

This test is similar to test 1.2.7. For this test the print-item

following a TAB-call in a print-list is a string-variable. The output is the same as that of test 1.2.7.

******************

* PROGRAM FILE 1 * ******************

10 PRINT "PROGRAM FILE 1"

20 PRINT

30 PRINT

40 PRINT

50 PRINT

60 PRINT " 70 PRINT " *******************

* *
80 PRINT " MINIMAL BASIC TEST PROGRAM *" 90 PRINT " * PREPARED BY *" 100 PRINT ft NATIONAL BUREAU OF STANDARDS *

110 PRINT M VERSION 1 *" 120 PRINT »• * * " 130 PRINT II * ft****************11 140 PRINT

150 PRINT

160 PRINT

220 PRINT »• SECTION 1.1: NULL PRINT."

230 PRINT

240 PRINT N BEGIN TEST."

250 PRINT M THIS IS LINE 1."

260 PRINT n THIS IS LINE 2."

270 PRINT

280 PRINT M THIS IS LINE 4, 3 SHOULD HAVE BEEN SKIPPED."

290 PRINT M THIS IS LINE 5.”

300 PRINT

310 PRINT

320 PRINT N THIS IS LINE 8, 6 AND 7 SHOULD HAVE BEEN SKIPPED

330 PRINT n END TEST."

340 PRINT

350 PRINT n SECTION 1.2: PRINT OF AND ASSIGNMENT OF QUOTED STRINGS.

360 PRINT

370 PRINT II SECTION 1.2.1: ALLOWED CHARACTERS."

380 PRINT

390 PRINT n BEGIN TEST."

400 PRINT

410 PRINT M ABCDEFGHI JKLMNOPQRSTUVWXYZ

420 PRINT •I 1234567890"

430 PRINT m ()&!# %'?*$"

440 PRINT n 450 PRINT •t . .

•• • 9 460 PRINT

470 PRINT

480 PRINT M END TEST."

490 PRINT

500 PRINT It SECTION 1.2.2: SPACES IN QUOTED STRINGS."

510 PRINT

520 PRINT n BEGIN TEST."

530 PRINT

540 PRINT m ABCDEFGHI JKLMNOPQRSTUVWXYZ

550 PRINT n A CD GH LM RS YZ"

560 PRINT

570 PRINT N END TEST."

580 PRINT

590 PRINT n SECTION 1. 2.3.: END-OF-LINE TEST, QUOTED STRINGS

600 PRINT

610 PRINT N BEGIN TEST."

620 PRINT

630 PRINT n THIS LINE COMES FROM ONE QUOTED STRING PRINT."

640 PRINT ti THIS LINE IS THE OUTPUT OF THE NEXT PRINT."

650 PRINT ii PAST TWO PRINT LINES MUST BEGIN WITH: THIS LINE.

660 PRINT W n 670 PRINT H LINE ABOVE THIS MUST BE BLANK (AN EMPTY STRING)

.

680 PRINT H LINE BELOW THIS MUST BE BLANK (NULL PRINT)."

690 PRINT

5
700 PRINT " 710 PRINT

720 PRINT " 730 :PRINT

740 :PRINT " 750 :PRINT

760 PRINT " 770 : PRINT " 780 :PRINT " 790 PRINT " 800 PRINT " 810 PRINT " 820 PRINT " 830 PRINT " 840 PRINT " 850 PRINT

860 PRINT " 870 PRINT

880 PRINT " 890 PRINT

900 PRINT " 910 PRINT

920 PRINT " 930 PRINT " 940 PRINT " 950 PRINT " 960 PRINT

970 PRINT " 980 PRINT

990 PRINT " 1000 PRINT

1010 PRINT

1020 PRINT

1030 PRINT

1040 PRINT

1050 PRINT

1060 PRINT

1070 PRINT

1080 PRINT

1090 PRINT

1100 PRINT

1110 PRINT

1120 PRINT

1130 PRINT

1140 PRINT

1150 PRINT

1160 PRINT

1170 PRINT

1180 PRINT

1190 PRINT

1200 PRINT

1210 PRINT

1220 PRINT

1230 PRINT

1240 PRINT

1250 PRINT

1260 PRINT

END TEST."

SECTION 1.2.4: SEMICOLON SEPARATOR, QUOTED STRINGS.”

BEGIN TEST."

1. 123"

2. 1" ;”2";"3"

2 "; 3"

END TEST."

SECTION 1.2.5: 72 CHARACTER PRINT."

BEGIN TEST."

00000000011111111112222222222333333333344444444445";

5555555556666666666777"

1234567890123456789012345678901234567890123456'7 890";

1234567890123456789012"

END TEST."

SECTION 1.2.6: COMMA SEPARATOR, QUOTED STRINGS."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556666666666777"

"12345678901234567890123456789012345678901234567890";

"1234567890123456789012"

"XYZ ", "XYZ ", "XYZ

END TEST."

" SECTION 1.2.7: TABBING QUOTED STRINGS WITHIN 72 CHARACTER"

" POSITIONS."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556666666666777"

"12345678901234567890123456789012345678901234567890";

"1234567890123456789012"

TAB (24) ; "1"

TAB ( 4 8 ) ; " 2

TAB (7 2) ; "3"

END TEST."

6
1270 PRINT " 1280 PRINT

1290 PRINT " 1300 PRINT

1310 LET A$="18 ( 1320 LET B $=A$

1330 LET C $=B $

1340 LET D$=C $

1350 LET E$=D$

1360 LET F$=E$

1370 LET G$=F $

1380 LET H$=G$

1390 LET I $=H $

1400 LET J$ = I$

1410 LET K$=J$

1420 LET L$=K$

1430 LET M$=L$

1440 LET N$=M$

1450 LET 0$=N $

1460 LET P$=0$

1470 LET Q$“P$

1480 LET R$=Q$

1490 LET S $=R$

1500 LET T$=S $

1510 LET U$=T$

1520 LET V$=U$

1530 LET W$=V$

1540 LET X$=W$

1550 LET Y$=X$

1560 LET Z $=Y$

1570 PRINT " 1580 PRINT

1590 PRINT " 1600 PRINT

1610 PRINT " 1620 PRINT

1630 PRINT " 1640 PRINT

1650 LET A$=" 123

1660 LET B$="l"

1670 LET C$=" 2"

1680 LET D $ = " 3

" 1690 LET E $ = " 1 2

" 1700 LET F $ = " 2 3

" 1710 PRINT " 1720 PRINT " 1730 PRINT " 1740 PRINT F$

1750 PRINT " 1760 PRINT D$

1770 PRINT " 1780 PRINT C$

;

1790 PRINT D$

1800 PRINT

1810 PRINT " 1820 PRINT

1830 PRINT "

SECTION 1.2.8: ASSIGNMENT OF QUOTED STRINGS."

BEGIN TEST."

;Z$

END TEST."

SECTION 1.2.9: SEMICOLON SEPARATOR, ASSIGNED STRINGS."

BEGIN TEST."

1

.

" ;A$

2 . "

; B $ ;C $ ; D$

3 . "

; B $ ;

4 . " ; E $

;

5.";B$;

END TEST."

SECTION 1.2.10: COMMA SEPARATOR, ASSIGNED STRINGS."

7
1840

1850

1860

1870

1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

1980

1990

2000

2010

2020

2030

2040

2050

2060

2070

2080

2090

2100

2110

2120

2130

2140

2150

2160

PRINT

PRINT " BEGIN TEST."

PRINT

LET A$="XYZ

LET B$="XYZ

LET C $ = " XYZ

PRINT "00000000011111111112222222222333333333344444444445";

PRINT "5555555556666666666777"

PRINT "1234567890123456789012345678901234567890123456 7 890";

PRINT "1234567890123456789012"

PRINT A$,B$,C$

PRINT

PRINT " END TEST."

PRINT

PRINT "SECTION 1.2.11: TABBING ASSIGNED STRINGS WITHIN 72 CHARACPRINT " TER POSITIONS."

PRINT

PRINT " BEGIN TEST."

PRINT

LET A$=" 1

LET B $ = " 2

LET C$=" 3"

PRINT "00000000011111111112222222222333333333344444444445";

PRINT "5555555556666666666777"

PRINT " 1 234 5 6789 01 234 56 7 8 90 12 34 567 8 90 12 34 567 8901 234 56 7 890" ; PRINT "1234567890123456789012"

PRINT TAB (24) ;A$

PRINT TAB (48) ;B$

PRINT TAB (72) ;C$

PRINT

PRINT " END TEST.

PRINT

END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 1

******************

* *

* MINIMAL BASIC TEST PROGRAM *

* PREPARED BY *

* NATIONAL BUREAU OF STANDARDS *

* VERSION 1

*

* * ******************

8
SECTION 1.1: NULL PRINT.

BEGIN TEST.

THIS IS LINE 1.

THIS IS LINE 2.

THIS IS LINE 4, 3 SHOULD HAVE BEEN SKIPPED.

THIS IS LINE 5.

THIS IS LINE 8, 6 AND 7 SHOULD HAVE BEEN SKIPPED

END TEST.

SECTION 1.2: PRINT OF AND ASSIGNMENT OF QUOTED STRINGS.

SECTION 1.2.1: ALLOWED CHARACTERS.

BEGIN TEST.

ABCDEFGHI JKLMNOPQRSTUVWXYZ

1234567890

()&!# %'?*$

+ #-/<=>'*•

END TEST.

SECTION 1.2.2: SPACES IN QUOTED STRINGS.

BEGIN TEST.

ABCDEFGHI JKLMNOPQRSTUVWXYZ

A CD GH LM RS YZ

END TEST.

SECTION 1.2.3.: END-OF-LINE TEST, QUOTED STRINGS

BEGIN TEST.

THIS LINE COMES FROM ONE QUOTED STRING PRINT.

THIS LINE IS THE OUTPUT OF THE NEXT PRINT.

PAST TWO PRINT LINES MUST BEGIN WITH: THIS LINE.

LINE ABOVE THIS MUST BE BLANK (AN EMPTY STRING).

LINE BELOW THIS MUST BE BLANK (NULL PRINT)

.

END TEST.

SECTION 1.2.4: SEMICOLON SEPARATOR, QUOTED STRINGS

BEGIN TEST.

1. 123

2. 123

3. 123

9
4. 123

5. 123

END TEST.

SECTION 1.2.5: 72 CHARACTER PRINT.

BEGIN TEST.

0000000001111111111 222222 222233333333334444444444555555555 56666666666^7T

123456789012345678901234567890123456789012345678901234567890123456789012

END TEST.

SECTION 1.2.6: COMMA SEPARATOR, QUOTED STRINGS.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

1 234 56 7890 1 2 34 567890 1 234 567 8 90 12 34 5 67890 12 34 5678901 234 56"7890 12 3 4 567890 12

XYZ XYZ XYZ

END TEST.

SECTION 1.2.7: TABBING QUOTED STRINGS WITHIN 72 CHARACTER

POSITIONS.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

END TEST.

SECTION 1.2.8: ASSIGNMENT OF QUOTED STRINGS.

BEGIN TEST.

18 CHARACTERS LONG

END TEST.

SECTION 1.2.9: SEMICOLON SEPARATOR, ASSIGNED STRINGS.

BEGIN TEST.

1.123

2.123

3.123

4.123

5.123

END TEST.

10
SECTION 1.2.10: COMMA SEPARATOR, ASSIGNED STRINGS.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

XYZ XYZ XYZ

END TEST.

SECTION 1.2.11: TABBING ASSIGNED STRINGS WITHIN 72 CHARACTER POSITIONS.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

1234 56789012 34 567890 1234 56789012345678901234567 890123456^890123456789012

END TEST.

11
2.0

EXCEPTION TEST FOR PRINTING TAB BEYOND THE LEFT MARGIN

The objective of this routine is to execute error tests on improper

numeric arguments for the TAB-call (see section 12.5 of BSR X3.60 )•

This testing is performed as follows:

2.1

TAB Argument is 0

First, it verifies that when the rounded argument of the TAB-call is

less than one, the implementation supplies an argument value of one and

continues program execution. This part of the test uses an argument value of zero in the TAB-call. On output there should be an X in the first column

position.

2.2

TAB Argument is Negative

This part of the test further verifies the procedure specified in test

2.1. However, for this test -10 is the argument of the TAB-call. The output

should be the same as in 2.1.

******************

* PROGRAM FILE 2

* ******************

10 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 PRINT

250 PRINT

PROGRAM FILE 2"

SECTION 2.0: ERROR TEST ON PRINT TAB."

" THIS SECTION USES TWO DIFFERENT TAB ARGUMENTS TO TEST"

"THE CASE WHEN A ROUNDED TAB ARGUMENT HAPPENS TO HAVE A VALUE

"LESS THAN ONE. IN SUCH A CASE THIS SHOULD BE HANDLED AS A"

"NON-FATAL ERROR WHEREBY A VALUE OF 1 IS TO BE SUPPLIED FOR"

"THE TAB ARGUMENT AND THE PROGRAM SHOULD CONTINUE."

" SECTION 2.1: TAB ARGUMENT IS 0."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

II

12
260

270

280

290

300

310

330

340

350

360

370

380

390

400

410

420

430

440

450

460

470

480

500

510

520

PRINT "5555555556666666666777"

PRINT "12345678901234567890123456789012345678901234567890";

PRINT "1234567890123456789012"

PRINT TAB (0) ; "X"

PRINT

PRINT " IF AN X LIES IN COLUMN 1, TEST PASSED."

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " SECTION 2.2; TAB ARGUMENT IS NEGATIVE

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT "00000000011111111112222222222333333333344444444445";

PRINT "5555555556666666666777"

PRINT "12345678901234567890123456789012345678901234567890";

PRINT "1234567890123456789012"

PRINT TAB (-10) ; "X"

PRINT

PRINT " IF AN X LIES IN COLUMN 1, TEST PASSED."

PRINT

PRINT " END TEST."

END

II

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 2

SECTION 2.0: ERROR TEST ON PRINT TAB.

THIS SECTION USES TWO DIFFERENT TAB ARGUMENTS TO TEST

THE CASE WHEN A ROUNDED TAB ARGUMENT HAPPENS TO HAVE A VALUE

LESS THAN ONE. IN SUCH A CASE THIS SHOULD BE HANDLED AS A

NON-FATAL ERROR WHEREBY A VALUE OF 1 IS TO BE SUPPLIED FOR

THE TAB ARGUMENT AND THE PROGRAM SHOULD CONTINUE.

SECTION 2.1; TAB ARGUMENT IS 0.

BEGIN TEST.

13
000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

X

IF AN X LIES IN COLUMN 1, TEST PASSED.

END TEST.

SECTION 2.2: TAB ARGUMENT IS NEGATIVE.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

X

IF AN X LIES IN COLUMN 1, TEST PASSED.

END TEST.

lU
3.0 USING EMPTY PRINT ITEMS TO SPACE OVER PRINT ZONES

The objective of this test is to verify that the comma separator allows

users to produce automatically positioned output in a tabular format as determined by the print zones (see section 12.4 of BSR X3.60 ).

Furthermore, it verifies that null print items can be used in the print-list.

The term "null" refers to the space character. The test uses a print-list

which has three single space characters and a quoted string as print-items.

Each print-item is separated by a comma print-separator. The output for this

test should show an A in the first column position of the fourth print zone assuming the implementation has four print zones. This is a reasonable

assumption for most systems.

******************

* PROGRAM FILE 3

* ******************

10 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 PRINT

250 PRINT

260 PRINT

270 PRINT

280 PRINT

290 PRINT

300 PRINT

310 PRINT

320 PRINT

330 PRINT

340 PRINT

PROGRAM FILE 3"

SECTION 3.0: NULL PRINT ITEMS."

" * * * * *NOTE : THE FIRST THREE PRINT ITEMS ARE NULL, THEREFORE"

"THE FOURTH PRINT ITEM WHICH IS A STRING EXPRESSION SHOULD"

"APPEAR IN THE BEGINNING COLUMN OF THE FOURTH PRINT ZONE FOR"

"THIS SYSTEM (THAT IS, IF THE SYSTEM PARTITIONS FOUR OR MORE"

"ZONES TO A LINE.)*****"

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556666666666777"

"12345678901234567890123456789012345678901234567890";

"1234567890123456789012"

"A" i t r n

" IF THE A IS IN THE BEGINNING COLUMN OF THE FOURTH"

"PRINT ZONE FOR THIS SYSTEM, THEN THE SYSTEM WILL HAVE PASSED"

"THE TEST."

" END TEST.

15
350 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 3

SECTION 3.0: NULL PRINT ITEMS.

*****NOTE: THE FIRST THREE PRINT ITEMS ARE NULL, THEREFORE

THE FOURTH PRINT ITEM WHICH IS A STRING EXPRESSION SHOULD

APPEAR IN THE BEGINNING COLUMN OF THE FOURTH PRINT ZONE FOR

THIS SYSTEM (THAT IS, IF THE SYSTEM PARTITIONS FOUR OR MORE

ZONES TO A LINE.)*****

BEGIN TEST.

000000000111111 II 11222222222233333333334444444444555555555566666666667 77

1234567890123456789012345678901234567890123456'7 8901234567890123456'7 89012

A

IF THE A IS IN THE BEGINNING COLUMN OF THE FOURTH

PRINT ZONE FOR THIS SYSTEM, THEN THE SYSTEM WILL HAVE PASSED

THE TEST.

END TEST.

16
4.0

4.1 PRINTING INTEGER AND FIXED POINT CONSTANTS

Printing Constants with Six Significant Digits

The Minimal BASIC standard specifies that a program can contain numeric

constants that have an arbitrary number of digits. However, the

specification allows implementations to round the values of the constants to an implementation-defined precision of not less than six significant decimal

digits. Therefore in general we have restricted our concern to the proper

handling of numbers with six significant digits. The user is referred to

section 5 and 12 of BSR X3.60 for the required specifications.

In order to clarify some of the notation used we take NRl to mean an integer constant or implicit point representation form and NR2 to mean a fixed point form or explicit point unsealed representation. We must make it

clear that the standard does not specify internal machine representation so that NRl and NR2 refer only to external character appearance or graphical

appearance and not to internal machine representation.

4.1.1

Constants in NRl Form (Integers)

This section verifies that the test implementation recognizes and prints

numbers that appear in the integer or NRl format. In recognizing the NRl

format, the particular implementation should maintain at least six

significant digits of precision on output. The test uses columnar output to

show, in the first column, how the numbers should appear according to

standard form, and in the second column, how the numbers are printed by the

system being tested. The print-lists, in the source code, which contain the

print-items for the numerical output use both signed and unsigned NRl

constants

.

4.1.2

NRl Constants Separated by Commas

The objective of this test is similar to that of test 1.2.6. However,

for this test, the print-items in the print-list are numerical constants in

NRl form. On output there is a string of digits used as column counters.

This string of digits is followed by two lines of integers. The integers on the first line are 1, -12, and 123 in their respective print zones. The

second line of integers contains -1234, 12345, and -123456 in their

respective print zones.

4.1.3

Space Allotment for Integers, in Compact Form

The objective of this test is to verify that there is a sufficient

amount of spacing upon output of NRl constants. That is, the evaluation of

each NRl constant should produce a string of characters consisting of a leading space if the number is positive or a leading minus sign if the number

is negative, followed by the decimal representation of the number and a trailing space. This implies that d + 2 spaces are the minimal required for

printing NRl constants. The "d" is the significance-width for the number of

significant decimal digits printed in numeric representations. For NRl

constants "d" is required to have a minimal value of at least six digits.

IT
The output of the test generates four columns of NRl constants. Each

print-list, contains numbers to be printed, and quoted strings containing

asterisks. These strings are separated from the constants by semicolons and are used to delineate spacing generated around the numeric output. Since

semicolons generate no spaces, the four columns of numbers should be

surrounded by asterisks to identify the number of spaces allocated for an NRl

representation by the implementation. The output is headed by strings of

digits that can be used as column counters. Beneath these strings of digits

should be the four columns of numbers. The first column is an example of

standard conformance for the implementation's second column of numbers. The

third column is an example of standard conformance for the fourth column of

numbers which are printed by the implementation.

4.1.4 NRl Constants Separated by Semicolons

The objective here is two-fold: the test should show that the

evaluation of the semicolon separator generates the null string, and at the same time, the test should show on output a minimum of two spaces between

each pair of numbers. On output there should be a string of digits which can

be used as column counters in determining whether the printed numbers have a minimum of two spaces between each pair.

4.1.5 Constants in NR2 Form (Reals)

There are two conditions under which numbers are to be printed in NR2

format. Let d be the number of significant digits of accuracy of the

machine. Then, the first condition arises when the number is not

representable as an integer, i.e., NRl, yet falls in the interval

0 . 1 — ( 0 . 5) * ( 10 ~ ( — d— 1 ) ) to (10~d) - (1/2)

.

Notice that as d increases both endpoints increase. The left hand endpoint

is never greater than 0.1, however. Next, since the minimal precision

requirement is d=6, then (10^6) — (1/2) is the smallest right hand endpoint.

Therefore, all numbers on all implementations that are not representable as integers, yet fall between 0.1 and 999999 in absolute value, must be printed

in NR2 format. Notice that with systems having six digits of precision one can only get numbers with fractional parts up to 99999.9 without rounding.

All numbers from 100000 to 999999 should be rounded to the nearest integer

and output in NRl if only 6 digits of precision are being carried by the

system.

The second case occurs when a number is less than 0 . 1- (0 . 5) * (10~ (-d-1)

)

in absolute value yet can be represented exactly with d digits after the

decimal point. For example, if d = 6 then 10~(-6) must be printed as . 000001.

The actual

numbers, both

99999.9 are prin

should have at 1 be representable

conducted in a

1) 14 numbers of

have been ente zeroes deleted.

test is divided

signed and un ted for testing

east six signif

exactly withou

subsequent tes

absolute value

red with trai

2) 5 numbers o

into two parts. In the first part a set of

signed, with absolute values between 0.1 and

the NR2 printing format. The numbers printed

icant figures. The numbers printed should all

t roundoff. Specific roundoff tests will be

t. The distribution of numbers is as follows:

between 0.1 and 1.0 were chosen. Of these, 5 ling zeroes. The outputs should have trailing

f absolute value between 1.0 and 10000. 3) 10

18
numbers of absolute value between 10000 and 99999.9. Columns one and three

should fall in print zones one and three. These represent the minimal

required output formats. Column three should have a leading minus sign, as well as column four. The first and third columns are the standard output

forms requiring d+3 characters counting minus sign or leading blank for

positive number, period and trailing space. For systems with d>6 the

standard numbers as given would be numbers with the 6 characters as specified

and d-6 trailing zeroes which would be required to be suppressed. Columns

two and four may have more than d+3 spaces allocated. The point of the test

is that however many spaces are allocated by the implementation, the minimal

requirement is d+3. For example, implementations may choose to line up

decimal points for all NR2 numbers and allow more than d spaces on either

side of the decimal. This is acceptable. The listing of column two contains

numbers that are alternately signed and unsigned positively. The output of

column two should be unsigned. The second part of the test outputs numbers

less than 0. 1 — ( 0 . 5) * (10~ (-7) ) that are exactly representable with d digits

after the decimal. Since d=6 is the minimal requirement, all numbers chosen

are based on this. The test for other values of d will appear in the

roundoff test.

4.1.6

NR2 Constants Separated by Commas

The objective of this test is similar to test 1.2.6. However, for this

test the print-items in the print-list are numeric constants, in NR2 form.

On output there should be a string of digits which can be used as column

counters. This string of digits should be followed by two lines of numerals.

The numerals on the first line should be: 123456, -99999.9, and 91234.5 in

their respective print zones. The second line of numerals should be

-1.23456, 89123.4, and -2.34567 in their respective print zones.

4.1.7

Space Allotment for Reals, in Compact Form

The object of this test section is to print a set of numbers in packed

form under a column index scheme to assess the conformance with the minimal

d+3 character rule for NR2 numbers. As in the test for section 4.1.3, there

are four columns of numbers. Columns one and three are minimal conformance

numbers for the case d=6. These numbers have 9 characters. Columns two and

four which would be generated by the test system might have more spaces

allocated for the number than the minimal conformance requirement. The rule

in general is that there should be at least d+3 characters allocated. In

order to determine the actual number of characters allowed by the system the

columns have been bracketed by asterisks. Again, columns two and four are

the system generated columns. These are the columns to which the rule must

be applied. There must be at least one trailing space for all numbers and a leading space if the number printed is positive.

4.1.8

NR2 Constants Separated by Semicolons

The objective of this test is the same as test 4.1.4. However, for this

test NR2 constants are being used as the print-items. The output should be

similar in format to that of test 4.1.4 except that explicit point unsealed

constants should appear. The user should examine the spacing between numbers

in a line. There should be a trailing space for all numbers and a leading

space if the number is positive.

19
******************

10 PRINT ' 70 PRINT

80 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 PRINT

250 PRINT

260 PRINT

270 PRINT

280 PRINT

290 PRINT

300 PRINT

310 PRINT

320 PRINT

330 PRINT

340 PRINT

350 PRINT

360 PRINT

370 PRINT

380 PRINT

390 PRINT

400 PRINT

410 PRINT

420 PRINT

430 PRINT

440 PRINT

450 PRINT

460 PRINT

470 PRINT

480 PRINT

490 PRINT

500 PRINT

510 PRINT

520 PRINT

530 PRINT

540 PRINT

550 PRINT

* PROGRAM FILE 4 * ******************

PROGRAM FILE 4"

"SECTION 4.1: PRINT/CONSTANTS, WITHIN 6 SIGNIFICANT DIGITS."

" SECTION 4.1.1: CONSTANTS IN NR1 FORM (INTEGERS)."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556666666666777"

"12345678901234567890123456789012345678901234567890";

"1234567890123456789012"

"STANDARD" , "TEST SYSTEM" ," STANDARD" , "TEST SYSTEM"

" 1",+1,"-1" ,-l

" 12 ", 12 ,"

12", -12

" 123" ,+123, "-123" ,-123

" 1234", 1234, "-1234", -1234

" 12345", +12345, "-12345", -12345

" 123456" ,123456,"-123456" ,-123456

" 999999" ,+999999, "-999999" ,-999999

" END TEST.

" SECTION 4.1.2: NRl CONSTANTS SEPARATED BY COMMAS."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556666666666777"

" 123456^89012345678 90 12 34 5678901234567890123456’7 890";

"1234567890123456789012"

1,-12,123

-1234,12345,-123456

" END TEST."

"SEC. 4.1.3: SPACE ALLOTMENT FOR INTEGERS, IN COMPACT FORM."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556666666666777"

"1234567890123456789012345678901234567890123456 7 890";

"1234567890123456789012"

"STANDARD";" SYSTEM";" STANDARD";" SYSTEM"

«* i ******" . i.«*_i ****** » . _i . •• *******

" * 12 *****" ;+ 12;"*-12 *****'';

12 ; "*****'•

20
560 PRINT

570 PRINT

580 PRINT

590 PRINT

600 PRINT

610 PRINT

620 PRINT

630 PRINT

640 PRINT

650 PRINT

660 PRINT

670 PRINT

680 PRINT

690 PRINT

700 PRINT

710 PRINT

720 PRINT

730 PRINT

740 PRINT

750 PRINT

760 PRINT

770 PRINT

780 PRINT

790 PRINT

"* l s> ^ ****"•. tot.  «..ni."** **"

*

1234 ***"1+1234; "*-1234 ***" ; -1234 ; " ***

"* 12345 **"; 12345; "*-12345 **"; -12345; "**"

"* 123456 *";+123456; "*-123456 *"; -123456 ;"*

"* 999999 *" ;999999;" *-999999 *" ; -999999 ;"*

" END TEST."

" SECTION 4.1.4: NRl CONSTANTS SEPARATED BY SEMICOLONS

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556666666666777"

"12345678901234567890123456789012345678901234567890";

"1234567890123456789012"

1

; -12 ; 123

-1234; 12345; -123456

END TEST."

SECTION 4.1.5: CONSTANTS IN NR2 FORM (REALS)."

BEGIN TEST."

800 PRINT

810 PRINT

820 PRINT

830 PRINT

840 PRINT

850 PRINT

860 PRINT

870 PRINT

880 PRINT

890 PRINT

900 PRINT

910 PRINT

920 PRINT

930 PRINT

940 PRINT

950 PRINT

960 PRINT

970 PRINT

980 PRINT

990 PRINT

'00000000011111111112222222222333333333344444444445";

'5555555556666666666777"

'12345678901234567890123456789012345678901234567890";

'1234567890123456789012"

’STANDARD" , "TEST SYSTEM" STANDARD" f " TEST SYSTEM"

' .1 ",.l,"-.l ”,-.1

' .12 ",+. 12, "-.12 ",-.12

' .123 ",.123, "-.123 " 123

' .1234 ",+.1234, "-.1234 ",-.1234

’ .12345 ",.12345, "-.12345 ",-.12345

’ .123456 ",+.123456, "-.123456 ",-.123456

1 .23456? ",.234567, "-.234567 ",-.234567

1 .345678 ",+.345678, "-.345678 ",-.345678

1 .456789 ",.456789, "-.456789 ",-.456789

1 .56789 ",+.567890, "-.56789 ",-.567890

1 .6789 ", .678900, "-.6789 ",-.678900

1 .789 ",+.789000, "-.789 ",-.789000

',-.890000

900000

,-12.3456

1000 PRINT H .89 ",. 890000,"-. 89

1010 PRINT II .9 ",+. 900000, "-.9

1020 PRINT II 1.23456 ",1.23456,"

1030 PRINT 01 9.87654 " ,+9.87654,

1040 PRINT n 12. 3456 ”,12.3456,"

1050 PRINT 10 123.456 ",+123.456,

1060 PRINT n 1234.56 ",1234.56,"

1070 PRINT ii 12345.

6

",+12345.6,

1080 PRINT •t 23456.7 ",23456.7,"

1090 PRINT 10 34567.8 ",+34567.8,

1100 PRINT ii 45678.9 ",45678.9,"

1110 PRINT ii 56789.1 ",+56789.1,

1120 PRINT ii 67891.2 ",67891.2,"

-12345.6

',-56789.1

-67891.2

n

21
1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1340

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

" 78912.3 " ,+78912. 3, "-78912. 3 ",-78912.3

" 89123.4 " ,89123.4," -89123.4 ",-89123.4

" 91234.5 ",+91234.5,"-91234.5 “,-91234.5

" 99999.9 " ,99999. 9, "-99999. 9 ",-99999.9

" END PART I

PART II"

022222 ",+. 022222, "-. 022222 ",-.022222

004444 ",. 004444, "-. 004444 ",-.004444

000888 ",+.000888, "-.000888 ",-.000888

000044 ",.000044, "-.000044 ",-.000044

000002 ",+. 000002, "-. 000002 ",-.000002

" END TEST."

" SECTION 4.1.6: NR2 CONSTANTS SEPARATED BY COMMAS."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445" ; "5555555556666666666777"

"123456789012345678901234567890123456"7 8901234567890";

"1234567890123456789012"

.123456,-99999.9,91234.5

-1.23456,89123.4,-2.34567

" END TEST."

" SECTION 4.1.7: SPACE ALLOTMENT FOR REALS, IN COMPACT FORM."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445"

;

"5555555556666666666777"

"12345678901234567890123456789012345678901234567890";

"1234567890123456789012"

"STANDARD";" SYSTEM";" STANDARD";" SYSTEM"

"** .234567 **";+. 234567;"**-. 234567 **";-. 234567; "**"

"** 1.23456 **" ; 1. 23456; " * *- 1 . 23456 **

"

; -1 . 234 56 ; " **

"** 91234.5 **";+91234. 5; "**-91234. 5 **",--91234.5;"**"

"** 99999.9 **"; 99999.9;"**-99999.9 * *

"

; -99999 . 9

; " * *

" END TEST.

SECTION 4.1.8: NR2 CONSTANTS SEPARATED BY SEMICOLONS."

BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556 666666666-777"

"12345678901234567890123456789012345678901234567890";

"1234567890123456789012"

. 123 4 56; -999 99. 9; 91234.

5

22
1700 PRINT - 1 . 23456; 89123. 4; -2. 34567

1710 PRINT

1720 PRINT " 1730 PRINT

1740 END

END TEST."

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 4

SECTION 4.1: PRINT/CONSTANTS, WITHIN

SECTION 4.1.1: CONSTANTS IN

BEGIN

6 SIGNIFICANT DIGITS.

NRl FORM (INTEGERS).

TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

123456''8901234 5678901234 56 "7890123456789012345678901234567890 1234567 89012

STANDARD TEST SYSTEM STANDARD TEST SYSTEM

1 1 -1 -1

12 12 -12 -12

123 123 -123 -123

1234 1234 -1234 -1234

12345 12345 -12345 -12345

123456 123456 -123456 -123456

999999 999999 -999999 -999999

END TEST.

SECTION 4.1.2: NRl CONSTANTS SEPARATED BY COMMAS.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

12345678901234 567 890123456789012345678901234 567 89012 34 56"7890123456789012

1 -12 123

-1234 12345 -123456

END TEST.

SEC. 4.1.3: SPACE ALLOTMENT FOR INTEGERS, IN COMPACT FORM.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

23
123456789012345678901 234 5678901234 5678901234567890 12345678901234 5t 789012

STANDARD SYSTEM STANDARD SYSTEM

•k ^ ****** ^ 1 ******•—! ******

***** 12 *-12 *****-12 *****

123 **** 123 *-123 ****-123  

1234 ** * 1234 *-1234 ***-1234 *** 12345 ** 12345 *-12345 **-12345 ** 123456 *-123456 *-123456 * 999999 *-999999 *-999999 * 123456 * 999999 *

END TEST.

SECTION 4.1.4: NRl CONSTANTS SEPARATED BY SEMICOLONS.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

1 -12 123

-1234 12345 -123456

END TEST.

SECTION 4.1.5: CONSTANTS IN NR2 FORM (REALS).

BEGIN TEST.

000000000 111111111122222222223333333

123456789012345678901234567890123456

STANDARD TEST SYSTEM STANDARD

. 1 . 1 -.1

. 12 . 12 -.12

. 123 . 123 -.123

. 1234 . 1234 -.1234

. 12345 .12345 -.12345

. 123456 . 123456 -. 123456

. 234567 . 234567 -.234567

. 345678 . 345678 -.345678

.456789 . 456789 -.456789

. 56789 .56789 . -.56789

. 6789 . 6789 -.6789

. 789 . 789 -.789

. 89 . 89 -.89

. 9 . 9 -.9

1.23456 1.23456 -1.23456

9.87654 9.87654 -9.87654

12.3456 12.3456 -12.3456

123.456 123.456 -123.456

1234.56 1234.56 -1234.56

12345.6 12345.6 -12345.6

23456.7 23456.7 -23456.7

34567.8 34567.8 -34567.8

45678.9 45678.9 -45678.9

56789.

1

56789.1 -56789.1

67891.2 67891.2 -67891.2

33444444444455555555556666666666777

89012345678901234567890123456789012

TEST SYSTEM

-.1

-.12

-.123

-.1234

-.12345

-.123456

-.234567

-. 345678

-.456789

-. 56789

-.6789

-.789

-.89

-.9

-1 . 234 56

-9 .876 54

-1 2.34 56

-1 23.4 56

-1 234 . 56

-1 2345 . 6 -2 3456 .7

-3 4567 .8

-4 5678 .9

-56789 . 1 -6 7891 . 2

2h
78912.3 78912.3 -78912.3 -78912.3

89123.4 89123.4 -89123.4 -89123.4

91234.5 91234.5 -91234.5 -91234.5

99999.9 99999.9 -99999.9 -99999.9

END PART I.

PART II

. 022222 . 022222 -.022222 022222

.004444 .004444 -.004444 004444

. 000888 . 000888 -.000888 000888

. 000044 . 000044 -. 000044 000044

. 000002 . 000002 -.000002 000002

END TEST.

SECTION 4.1.6: NR2 CONSTANTS SEPARATED BY COMMAS.

BEGIN TEST.

00000000011111111112222222222333333333344 44444 4445555555555666666666677-7

123456789012345678901234567890123456789012345678901234567890123456789012

.123456 -99999.9 91234.5

-1.23456 89123.4 -2.34567

END TEST.

SECTION 4.1.7: SPACE ALLOTMENT FOR REALS, IN COMPACT FORM.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

STANDARD SYSTEM STANDARD SYSTEM

* * . 234567 . 234567 **-.234567 **-.234567 **

* * 1.23456 * 1.23456 **-1.23456 **-1.23456 * *

* 91234.5 * 91234.5 **-91234.5 **-91234.5

* 99999.9 * 99999.9 **-99999.9 **-99999.9 *

END TEST.

SECTION 4.1.8: NR2 CONSTANTS SEPARATED BY SEMICOLONS.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

.123456 -99999.9 91234.5

-1.23456 89123.4 -2.34567

END TEST.

25
5.0 PRINTING FLOATING POINT CONSTANTS

As in the previous section the words "floating point" refer to the

external character appearance, as for example, on input or output. It does

not mean that internal representation is required to be floating point,

although this is sometimes the case and software is sometimes used to perform

the required conversions for input and output formatting. The user should

refer to sections 5 and 12 of BSR X3.60 for the specifications

appropriate to this section.

5.1 Constants in NR3 Form (E-Format)

The objective of this part is to print constants that require the use of an explicit print scaled representation form. There are two cases in which

this should occur. First , if the number has a magnitude greater than

(10*d)-(l/2) and secondly, if the number is less than 0 . 1- (0 . 5

) * ( 10

~

( — d— 1 )

)

and cannot be expressed exactly with d decimal digits following a period.

bounds for the absolute value of numbers

This is the range of the magnitude of

by all systems supporting Minimal Basic,

are acceptable. Note that for NR3

on output, the significand, represented by x, must lie in the

which means that there must be one digit to the left of the

The minimal upper and maximal lower

are 1.E38 and l.E-38, respectively,

numbers that must be recognized

Larger ranges containing this range

represen tat i ons range 1<= x <10

decimal point.

The first part of this test subsection will print groups of large

numbers. The optional exrad sign will be either absent or a plus, the

significand will be either a plus (or optionally blank) or minus. The second

part of the test section prints 2 groups of small numbers with negative exrad

signs.

On output , if the sign of the significand

positive then a space is printed. The positiv

omitted. Although the sample output mainta

significand, the standard allows trailing

fractional part of the significand. Leading ze exrad. There is to be no spacing allowed in

not specify the output sign of the exrad. It c but as indicated above no spaces are allowed

violate the rule that spaces are not allowed in

of any of the numbe

e signs to the signifies

ins trailing zeroes i zeroes to be omitted

roes may be omitted i the exrad. The standar

an be either a + or no

in the exrad since this

numeric constants.

rs is

nd are

n the

i n the

n the

d does

sign,

would

The output is displayed as follows: After the test title a standard and

an optional form is given based upon d=6 and e=2. Below these initial

numbers, two columns of numbers should appear. All the numbers should be

equal to each other and be equal to one of the allowed forms. Of course in

the case that d is greater than 6 digits, extra zeroes in the significand of

the actual system output may appear or be deleted. The first group of

columns will have a positive signed significand in both columns. The exrad

will be signed in the second column in the source code. The numbers used in

the source code are various forms of implcit and explicit print scaled

versions of the same number.

26
In the second set, two columns of numbers as in the first set will be

printed. These will be generated by numbers having an unsigned significand

and either signed or unsigned exrads.

The group three

except that a minus

numbers will

sign in front

be

of

the same as the

the significand.

pr ev ious two groups

The fourth set will have only one standard form but there

columns of output below it. In this case there will

significand and negative signed exrad.

will

be an

be two

unsigned

Finally the fifth group will have

form. Both significand and exrad will

one column of output and one have negative signs.

standard

are

exr exr neg

For

In summary, then, for the positive significand and positive exrad there

the following sign combination input cases: signed significand, unsigned

ad; signed significand, signed exrad; unsigned significand, unsigned

ad; unsigned significand, signed exrad. For the positive significand and

ative exrad there are only two cases: signed and unsigned significand.

the negative significand and negative exrad there is only one case.

5.2 Printing of Some General NR3 Constants

This test is a continuation of test 5.1, part II. The object here is

simply to print a selection of NR3 numbers without attempting to consider the

many possible configurations of the same number. Columns one and two are allowed optional graphical representation. Column three contains the values

generated by the test system.

5.3 NR3 Constants Separated by Commas

The objective of this test is similar to that of test 1.2.6. In this

test, however, the print-items in the print-list are numeric constants in NR3

form. On output there is a string of digits as column counters. This string

of digits should be followed by two lines of numbers. The numbers in the

first line should be 1.00000E30, -9 . 87000E-37 , and 1.23456E32 in their

respective print zones. The second line of numbers should be -1.23456E32,

1.786500E36 and 5.00000E-20 in their respective print zones.

******************

* PROGRAM FILE 5

* ******************

27
10 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 PRINT

250 PRINT

260 PRINT

2 7 0 PRINT

280 PRINT

290 PRINT

300 PRINT

310 PRINT

320 PRINT

330 PRINT

340 PRINT

350 PRINT

360 PRINT

370 PRINT

380 PRINT

390 PRINT

400 PRINT

410 PRINT

420 PRINT

430 PRINT

440 PRINT

450 PRINT

460 PRINT

470 PRINT

480 PRINT

490 PRINT

500 PRINT

510 PRINT

520 PRINT

530 PRINT

540 PRINT

550 PRINT

560 PRINT

570 PRINT

580 PRINT

590 PRINT

600 PRINT

610 PRINT

PROGRAM FILE 5"

tl

Wn

w

M

n

cs

IIM

SECTION 5.1: CONSTANTS IN NR3 FORM (E-FORMAT)."

BEGIN TEST."

INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 1)"

a******************************************************"

* INPUT * SIGNIFICAND * EXRAD *" *********************************************************

* COLUMNS * PLUS SIGN * NO SIGN * PLUS SIGN * NO SIGN *" *********************************************************

* 1 * YES * * * YES *"

* 2 * YES * * YES * *" ******************************************************* •'

" STANDARD OUTPUT FOR GROUP 1 WHERE (D=6, E=2), H

"SHOULD BE:"," 1.23456E32 "

" OR OPTIONALLY,"

"SHOULD BE:"," 1.23456E+32 "

" OUTPUT OF SYSTEM."

+123456E27,+123456E+27

+123456. E27, +123456. E+27

+12345. 6E28, +12345. 6E+28

+1234. 56E29,+1234. 56E+29

+123. 456E30,+123. 456E+30

+12. 3456E31,+12. 3456E+31

+1. 23456E32,+1. 23456E+32

+. 123456E33,+. 123456E+33

+1. 2345600000000E32,+1. 2345600000000E+32

+. 00000123456E38,+. 00000123456E+38

+. 0000123456000 0E 37, +.00001234 56000 0E+37

INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 2)" ********************************************************

* INPUT * SIGNIFICAND * EXRAD *" *********************************************************

* COLUMNS * PLUS SIGN * NO SIGN * PLUS SIGN * NO SIGN *" ********************************************************

* 1

* * YES * * YES *"

* 2

* * YES * YES * *" *********************** ft********************************'

STANDARD OUTPUT FOR GROUP 2 WHERE (D=6, E=2),

28
620 PRINT

630 PRINT

640 PRINT

650 PRINT

660 PRINT

670 PRINT

680 PRINT

690 PRINT

700 PRINT

710 PRINT

720 PRINT

730 PRINT

740 PRINT

750 PRINT

760 PRINT

770 PRINT

780 PRINT

790 PRINT

800 PRINT

810 PRINT

820 PRINT

830 PRINT

840 PRINT

850 PRINT

860 PRINT

870 PRINT

880 PRINT

890 PRINT

900 PRINT

910 PRINT

920 PRINT

930 PRINT

940 PRINT

950 PRINT

960 PRINT

970 PRINT

980 PRINT

990 PRINT

1000 PRINT

1010 PRINT

1020 PRINT

1030 PRINT

1040 PRINT

1050 PRINT

1060 PRINT

1070 PRINT

1080 PRINT

1090 PRINT

1100 PRINT

1110 PRINT

1120 PRINT

1130 PRINT

1140 PRINT

1150 PRINT

1160 PRINT

1170 PRINT

1180 PRINT

"SHOULD BE:"," 1.23456E32 "

" OR OPTIONALLY,"

"SHOULD BE:"," 1.23456E+32 "

" OUT OF SYSTEM."

123456E27, 123456E+27

123456. E27, 123456. E+27

12345. 6E28, 12345. 6E+28

1234. 56E29, 1234. 56E+29

123.456E30,123.456E+30

12. 3456E31, 12. 3456E+31

1. 23456E32, 1. 23456E+32

. 123456E33, . 123456E+33

1. 2345600 00000 0E32,1.2345600000000E+3

2

. 00000123456E38,.00000123456E+38

. 00001234 56000 0E 37, . 0000123456000 0E+37

" INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 3)"

•• ******************************************************** "* " * INPUT * SIGNIFICAND * EXRAD *"

'• **********************************************************

" * COLUMNS * MINUS SIGN * NO SIGN * PLUS SIGN * NO SIGN *"

•• ********************************************************”

" * 1 * YES * * * YES *"

" * 2 * YES * * YES * *"

•• A*******************************************************"

STANDARD OUTPUT FOR GROUP 3 WHERE (D=6, E=2),"

SHOULD BE:" , " -1 . 2345 6E 32 "

OR OPTIONALLY,"

"SHOULD BE:" , " - 1 . 23456E+32 "

" OUTPUT OF SYSTEM."

-123456E27,-123456E+27

-123456. E27, -123456. E+27

0-12345. 6E 2 8, -12345. 6E+28

-1234. 56E 29, -1234. 56E+29

-123. 456E30,-123. 456E+30

-12. 34 56E 3 1,-1 2. 3456E+31

-1. 234 56E32, -1.234 56E+32

-. 123456E33,-. 12345 6E +33

-1. 23456 00 00000 0E 32,-1. 2345600000000E+3

2

-. 0000 01 234 56E 38,-. 00000 1234 56E+38

-. 0000123456000 0E 37, -.00001234 5600 00E+37

29
1190 PRINT

1200 PRINT

1210 PRINT

1220 PRINT

1230 PRINT

1240 PRINT

1250 PRINT

1260 PRINT

1270 PRINT

1280 PRINT

1290 PRINT

1300 PRINT

1310 PRINT

1320 PRINT

1330 PRINT

1340 PRINT

1350 PRINT

1360 PRINT

1370 PRINT

1380 PRINT

1390 PRINT

1400 PRINT

1410 PRINT

1420 PRINT

1430 PRINT

1440 PRINT

1450 PRINT

1460 PRINT

1470 PRINT

1480 PRINT

1490 PRINT

1500 PRINT

1510 PRINT

1520 PRINT

1530 PRINT

1540 PRINT

1550 PRINT

1560 PRINT

1570 PRINT

1580 PRINT

1590 PRINT

1600 PRINT

1610 PRINT

1620 PRINT

1630 PRINT

1640 PRINT

1650 PRINT

1660 PRINT

1670 PRINT

1680 PRINT

1690 PRINT

1700 PRINT

1710 PRINT

1720 PRINT

1730 PRINT

1740 PRINT

1750 PRINT

INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 4)"

" A*******************************************************"

" * INPUT * SIGNIFICAND * EXRAD *"

B ****** *iV**************************************************

" * COLUMNS * PLUS SIGN * NO SIGN * MINUS SIGN * NO SIGN *" *******************************************************''

” * 1 * YES * * YES * *"

" * 2

* * YES * YES * *"

" ********************************************************"

" STANDARD OUTPUT FOR GROUP 4 WHERE (D = 6, E=2),"

"SHOULD BE:"," 1.23456E-24 "

" AS FOR OPTIONALS ,

"NONE.

" OUTPUT OF SYSTEM."

+123456E-29, 123456E-29

+123456. E-29, 123456. E-29

+12345. 6E-28, 12345. 6E-28

+1234. 56E-27, 1234. 56E-27

+123. 456E-26, 123.456E-26

+12. 3456E-25, 12. 3456E-25

+1. 23456E-24, 1. 23456E-24

+. 123456E-23, . 123456E-23

+1. 234 5600 00 0000E-24,1. 234 560000 0000E-24

+.00000123456E-18,.00000123456E-18

+. 0000123456000 0E-1 9,. 0000123456000 0E-1

9

" INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 5)"

*• ********H**H***************jk*<i#*************iHMlr******** H " * INPUT * SIGNIFICAND * EXRAD *"

n ***********************************************************

" * COLUMNS * MINUS SIGN * NO SIGN * MUNIS SIGN * NO SIGN *"

M *********************************************************»»

" * 1 * YES * * YES * *"

» -AT********************************************************"

" STANDARD OUTPUT FOR GROUP 5 WHERE (D = 6, E=2),"

"SHOULD BE:" -1. 2345 6E -24 "

AS FOR OPTIONALS,

"NONE.

" OUTPUT OF SYSTEM."

-123456E-29

-123456. E-29

-12345. 6E-28

30
1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

1980

1990

2000

2010

2020

2030

2040

2050

2060

2070

2080

2090

2100

2110

2120

2130

2140

2150

2160

2170

2180

2190

2200

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

END

-1234. 56E-27

-123. 456E-26

-12. 3456E-25

-1. 23456E-24

-. 123456E-23

-1. 2345600000000E-24

-. 00000123456E-18

-. 00001234560000E-19

" END TEST."

" SECTION 5.2: EXECUTION OF SOME GENERAL NR 3 CONSTANT."

" BEGIN TEST."

"STANDARD" , "OPTIONAL" , "SYSTEM"

" 1. 00000E30 ",

" 5 . 000 00E-20 "

" 4 . 25000E-25 " "-3.60000E25 ",

"-7. 8910 0E 35 ",

" 1.78650E36 ",

" 9. 7654 3E 37 ",

" 9 . 00000E34 ",

"-9 . 87000E-37"

,

" 1 . 00000E+30

, "NONE" , 5E-20

, "NONE" , +. 425E

"-3.60000E+25

"-7. 89100E+35

" 1 . 78650E+36

" 9.76543E+37

" 9 . 00000E+37

"NONE" ,-9. 87E-

" , IE 30

-24

" ,-3. 6E25

" ,-7. 891E+35

" ,+l. 7865E+36

",9.76543E+37

" ,+9E34

37

END TEST."

" SECTION 5.3: NR3 CONSTANTS SEPARATED BY COMMAS."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"55555 5555666666666

6

7 77"

" 12345678901234567890123456 7 8901234567890123456'7 890";

"123456 78901234 56 7 89012"

lE30,-9. 87E-37, 1.234 56E 32

-1. 23456E32,+1. 7865E36, 5E-20

END TEST."

*****************

* SAMPLE OUTPUT * *****************

31
PROGRAM FILE 5

SECTION 5.1: CONSTANTS IN NR3 FORM (E-FORMAT)

.

BEGIN TEST.

INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 1) *******************************************************

* INPUT * SIGNIFICAND * EXRAD * *******************************************************

* COLUMNS * PLUS SIGN * NO SIGN * PLUS SIGN * NO SIGN * *******************************************************

* 1 * YES * * * YES *

* 2 * YES * * YES * * *******************************************************

STANDARD OUTPUT FOR GROUP 1 WHERE (D=6, E = 2) , SHOULD BE: 1.23456E32

OR OPTIONALLY,

SHOULD BE: 1.23456E+32

OUTPUT OF SYSTEM.

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1.23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1 . 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 2) *******************************************************

* INPUT * SIGNIFICAND * EXRAD * *******************************************************

* COLUMNS * PLUS SIGN * NO SIGN * PLUS SIGN * NO SIGN * *******************************************************

* 1

* * YES * * YES *

* 2

* * YES * YES * * *******************************************************

STANDARD OUTPUT FOR GROUP 2 WHERE (D=6, E=2),

32
SHOULD BE 1. 23456E32

OR OPTIONALLY,

SHOULD BE: 1.23456E+32

OUT OF SYSTEM.

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1 . 234 56E+32

1. 23456E+32

1 . 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

1. 23456E+32

INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 3)

a******************************************************

* INPUT * SIGNIFICAND * EXRAD * ********************************************************

* COLUMNS * MINUS SIGN * NO SIGN * PLUS SIGN * NO SIGN * ********************************************************

* 1 * y ES * * * YES *

* 2 * YES * * YES * * ********************************************************

STANDARD OUTPUT FOR GROUP

SHOULD BE: -1.23456E32

WHERE (D = 6 , E = 2 ) ,

OR OPTIONALLY,

SHOULD BE: -1.23456E+32

OUTPUT OF SYSTEM.

-1. 23456E+32

-1. 23456E + 32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1. 23456E + 32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1.23456E+32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1. 23456E+32

-1 . 23456 5+32

-1. 23456E+32

INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 4)

33
********************************************************

* INPUT * SIGNIFICAND * EXRAD * ********************************************************

* COLUMNS * PLUS SIGN * NO SIGN * MINUS SIGN * NO SIGN * ********************************************************

* 1 * YES * * YES * *

* 2

* * YES * YES * * ********************************************************

STANDARD OUTPUT FOR GROUP 4 WHERE (D=6, E=2),

SHOULD BE: 1.23456E-24

NONE.

AS FOR OPTIONALS

,

OUTPUT OF SYSTEM.

1.23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

1. 23456E-24

INPUT FORMS ON SIGNIFICAND AND EXRAD (GROUP 5) *********************************************************

* INPUT * SIGNIFICAND * EXRAD * *********************************************************

* COLUMNS * MINUS SIGN * NO SIGN * MUNIS SIGN * NO SIGN * *********************************************************

* 1 * YES * * YES * * *********************************************************

STANDARD OUTPUT FOR GROUP 5 WHERE (D = 6, E = 2) , SHOULD BE: -1.23456E-24

AS FOR OPTIONALS,

NONE.

OUTPUT OF SYSTEM.

-1. 23456E-24

-1. 23456E-24

-1. 23456E-24

-1. 23456E-24

3h
-1. 23456E-24

-1. 23456E-24

-1. 23456E-24

-1. 23456E-24

-1. 23456E-24

-1. 23456E-24

-1.23456E-24

END TEST.

SECTION 5.2: EXECUTION OF SOME GENERAL NR3 CONSTANT.

BEGIN TEST.

STANDARD

1. 00000E30

5. 00000E-20

4. 25000E-25

-3. 60000E25

-7. 89100E35

1. 78650E36

9. 7654 3E 37

9. 00000E34

-9. 87000E-37

OPTIONAL

1. 00000E+30

NONE

NONE

-3. 60000E+25

-7. 89100E+35

1. 78650E+36

9. 76543E+37

9. 00000E+3 7 NONE

SYSTEM

1. 00000E+30

5. 00000E-20

4. 25000E-25

-3. 60000E+25

-7. 89100E+35

1 . 78650E+36

9 . 76543E+37

9. 00000E+34

-9 . 87000E-37

END TEST.

SECTION 5.3: NR3 CONSTANTS SEPARATED BY COMMAS.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

1 . 00000E+30 -9.87000E-37

-1. 23456E+32 1.78650E+36

1. 23456E+32

5. 00000E-20

END TEST.

35
6.0

PRINTING OF FLOATING POINT NUMBERS (CONTINUED) AND

ASSIGNMENT OF INTEGER AND FIXED POINT VALUES

In this section we complete the task of evaluating the format of the NR3

constants separated by semicolon delimiters on output and begin the task of

assigning the previous numeric constant types to simple variables and

printing those variables. Again trailing zeroes in the significand are optional. The user is referred to section 5, 6, 9 and 12 of BSR X3.60

for specifications.

6.1

Printing NR3 Numbers with Semicolon Delimiters

6.1.1

Space Allotment (E-Format) in Compact Form

The objective of this test is similar to that of previous semicolon

separation tests. The representation of NR3 numbers requires exactly d+e+5

characters. Therefore, several NR3 numbers will be given, bracketed by

asterisks to delineate the number of characters allocated for an NR3 number.

The characters allow space for at most two signs, a period, the "E", and a trailing space.

6.1.2

NR3 Constants Separated by Semicolons

The objective of this test is the same as that of test 4.1.4. However,

for this test NR3 constants are being used as the print items. There should

be output similar to that of test 4.1.4 except for the numbers.

6.2

Assignment of Numeric Constants to Simple Variables

Numeric variables are named by either a single letter or a letter and a digit. Numeric variables may be either simple variables, which refer to

single values, or they may refer to elements of one or two dimensional

arrays. Such references are called subscripted variables. As indicated

above simple numeric variables consist of a letter followed by an optional

digit. Arrays will not be considered in this set of tests. They will be

deferred until after the Dimension statement has been introduced. Variables

can also be assigned to other variables. This is the first primitive

assignment of numeric expressions beyond assigning constants to variables.

There are 286 possible simple numeric variables.

6.2.1 Assignment of NRl Constants

The objective of this test is to verify that signed as well as unsigned

NRl constants can be assigned to simple variables. It also verifies that an assigned NRl constant can be assigned from one simple variable to another.

6. 2. 1.1 Unsigned Constants

36
The objective of this test is to verify that the positive sign is

optional when representing NRl constants. Therefore, this test determines

whether not having a plus sign with a number when it is assigned to a simple

variable causes any discrepancy. On output there should be two columns of

numbers. The first column of numbers represents the desired numbers, which

can be compared with those outputted in the second column as the evaluated

representations of the system.

6. 2.

1.2

Signed Constants

The objective of this test is the same as that of test 6. 2. 1.1 except

that this test uses signed NRl constants assigned to the simple variables.

The test has an output format similar to that of test 6. 2. 1.1.

6. 2.

1.3

Cross Assignment

The objective of this test is to determine whether repeated assignments

of an NRl constant between several different simple variables will modify the

value of that constant, thus verifying another phase of assigning numeric

expressions to simple variables. The test uses 26 of the simple variables, A

through Z. The simple variable A is initially assigned an NRl constant and

then the content of A is assigned to B, and then B to C, and then C to D;

and this sequence is con tinued through Z. The output represents the value

of Z which should be the value of the original NRl constant assigned to A.

6.2.2 Assignment of NR2 Constants

The objective of this test is to verify that signed as well as unsigned

NR2 constants can be assigned to simple variables. Also, it verifies whether

an assigned NR2 can be assigned from one simple variable to another.

6. 2. 2.1 Unsigned Constants

The objective of this test is to verify that the positive sign is op

tional when representing NR2 constants. Therefore, this test determines

whether there will be any modification in the numerical representation if an unsigned NR2 constant is assigned to a simple variable. On output there

should be two columns of numbers. The first column of numbers represents the

desired numbers that can be compared with those outputted in the second

column as the evaluated representations of the system.

6. 2. 2. 2 Signed Constants

The objective of this test is the same as that of test 2. 2. 2.1 except

that this test uses signed NR2 constants in the assignment made to the simple

variables. The test has a similar output format.

6. 2. 2.

3

Cross Assignment

37
The objective of this test is to determine whether repeated

of an NR2 constant between several different simple variables wi

value of that constant. The test uses 26 of the simple variable

Z0. The simple variable A0 is initially assigned the NR2 cons

the content of A0 is assigned to B0, and then B0 to C0, and then

and this sequence of assigning is continued through Z0.

represents the value of Z0 which should be the value of the

constant assigned to A0.

assignments

11 modify the

s, A0 through

tant and then

C0 to D0

;

The output

original NR2

******************

* PROGRAM FILE 6

*

10 PRINT 1 20 PRINT

30 PRINT

40 PRINT

90 PRINT 1 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 PRINT

250 PRINT

260 PRINT

270 PRINT

280 PRINT

290 PRINT

300 PRINT

310 PRINT

320 PRINT

330 PRINT

340 PRINT

350 PRINT

360 PRINT

370 PRINT

380 PRINT

390 PRINT

400 PRINT

PROGRAM FILE 6"

SECTION 6.1.1: SPACE ALLOTMENT (E-FORMAT), COMPACT FORM."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556666666666777"

"12345678901234567890123456789012345678901234567890";

"1234567890123456789012"

" STANDARD";" OPTIONAL";" SYSTEM"

"** 1.23456E32 1.23456E + 32 **

" ; 1 . 234 56E32 ; " * * " "**-1.23456E32 *

"

; " *- 1 . 234 56E+32 **" ; -1 . 23456E32; "**" "**-l. 23456E-24 *" ; " *-l . 234 56E-24 * *

”

; -1 . 2 34 56E-24 ; " * * " "** 1 . 00000E30 1 . 00000E+30 **";1E30;"**"

"**-9. 87000E-37 *" ; "*-9.

8

7 000E-3 7 ** " ; -9 .

8

7 E-37 ; " * * "

" END TEST."

" SECTION 6.1.2: NR3 CONSTANTS SEPARATED BY SEMICOLONS."

" BEGIN TEST."

"00000000011111111112222222222333333333344444444445";

"5555555556666666666777"

"12345678901234567890123456"7 890123456'7 8901234567890";

"123456 7 890123456789012"

1E30;-9.8 7 E-37;1.23456E32

-1. 23456E32;+1. 7 895E36; 5E-20

" END TEST."

38
410

420

430

440

450

460

470

480

490

500

510

520

530

540

550

560

570

580

590

600

610

620

630

640

650

660

670

680

690

700

710

720

730

740

750

760

770

780

790

800

810

820

830

840

850

860

8

"

7 0 880

890

900

910

920

930

940

950

960

970

PRINT

PRINT

PRINT " PRINT

PRINT "

SECTION 6.2: ASSIGNED NUMERIC CONSTANTS."

SECTION 6.2.1: ASSIGNMENT OF NRl CONSTANTS."

PRINT

PRINT

PRINT " PRINT

PRINT "

SECTION 6. 2. 1.1: UNSIGNED CONSTANTS TO A VARIABLE."

BEGIN TEST."

LET M 1=1

LET Jl=12345

LET K1=000

PRINT "NEEDED" , "SYSTEM"

PRINT "OUTPUT" , "OUTPUT"

PRINT

PRINT " 1 " , M

1

PRINT " 12345 ",J1

PRINT " 0 ",K1

PRINT

PRINT " END TEST."

PRINT

LET M 2=+2

LET L2=-3

LET N 2=-8 7 6 5 LET 02=+691

2

PRINT "NEEDED" , "SYSTEM"

PRINT "OUTPUT" , "OUTPUT"

PRINT

PRINT " 2 " ,M2

PRINT "-3 ",L2

PRINT "-8765 " , N

2

PRINT " 6912 " ,02

PRINT " END TEST."

PRINT

PRINT " SECTION 6. 2. 1.3: TRANSITIVE ASSIGNMENT OF AN NRl CONSTANT."

PRINT

PRINT " BEGIN TEST."

PRINT

LET A=-99999

LET B=A

LET C=B

LET D=C

LET E=D

LET F=E

LET G=F

LET H=G

LET I =H

LET J=I

LET K=J

LET L=K

LET M=L

LET N=M

PRINT

PRINT " PRINT

PRINT "

SECTION 6. 2. 1.2: SIGNED CONSTANTS TO A VARIABLE."

BEGIN TEST."

39
980 LET 0=N

990 LET P=0

1000 LET Q=P

1010 LET R=Q

1020 LET S=R

1030 LET T=S

1040 LET U=T

1050 LET V=U

1060 LET W=V

1070 LET X=W

1080 LET Y=X

1090 LET Z=Y

1100 PRINT "NEEDED" , "SYSTEM"

1110 PRINT "OUTPUT" , "OUTPUT"

1120 PRINT

1130 PRINT "-99999 ",Z

1140 PRINT

1150 PRINT " 1160 PRINT

11 7 0 PRINT " 1180 PRINT

1190 PRINT " 1200 PRINT

1210 PRINT

1220 LET A3=l . 05

1230 LET B3=358 . 672

1240 PRINT "NEEDED”

1250 PRINT "OUTPUT"

1260 PRINT

PRINT

PRINT

1290 PRINT

1300 PRINT " 1310 PRINT

1320 PRINT

1330 PRINT " 1340 PRINT

1350 PRINT " 1360 PRINT

1

3

7 0 LET A4=-2 .

1

1380 LET B4=+ 3 .

1

1390 LET C 4=-2714 . 25

1400 LET D4=+29. 3054

1410 PRINT "NEEDED",

1420 PRINT

1430 PRINT

1440 PRINT

1450 PRINT

1460 PRINT

1470 PRINT

1480 PRINT

1490 PRINT

1500 PRINT

1510 PRINT

1520 PRINT

1530 PRINT

1540 PRINT

END TEST."

SECTION 6.2.2: ASSIGNMENT OF NR2 CONSTANTS."

SECTION 6. 2. 2.1: UNSIGNED CONSTANTS TO A VARIABLE."

, "SYSTEM"

, "OUTPUT"

1270

1280

1.05 ",A3

358.672 " ,B3

END TEST."

SECTION 6. 2. 2. 2: SIGNED CONSTANTS TO A VARIABLE."

BEGIN TEST."

SYSTEM"

"OUTPUT" , "OUTPUT"

" - 2 . 1 ",A4

" 3.1 " , B 4 "-2714.25 " ,C4

" 29.3054 ",D4

END TEST."

SECTION 6. 2. 2. 3: TRANSITIVE ASSIGNMENT OF AN NR2 CONSTANT.

BEGIN TEST."

40
1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

1980

1990

2000

2010

2020

2030

2040

2050

2060

2070

2080

2090

2100

2110

LET A0=-9999. 99

LET B0=A0

LET C 0=B 0 LET D0=C0

LET E 0=D0

LET F0=E0

LET G0 =F 0 LET H 0 =G 0 LET I 0=H0

LET J 0 = 1

0

LET K0=J 0 LET L0=K0

LET M0=L0

LET N0=M0

LET O0=N0

LET P0=O0

LET Q0=P0

LET R0=Q0

LET S0=R0

LET T0=S 0 LET U0=T0

LET V0=U0

LET W0=V0

LET X0=W 0 LET Y0=X0

LET Z 0=Y 0 PRINT "NEEDED" ,

SYSTEM

PRINT "OUTPUT"," OUTPUT

PRINT

PRINT "-9999.99 " ,Z0

LET A5=l .

5

LET B 5=-2 .

5

LET C 5=+3 . LET D5=4 .

5

LET E5=+5 .

5

LET F5=-6.

5

LET A1=A5

LET B 1=B 5 LET C1=C5 * LET D1=D5

LET E 1=E 5 LET F 1=F 5 LET G1=A1

LET H l=Bl

LET I1=C1

LET J1=D 1 LET Kl=E 1 LET Ll=F 1 LET Ml=Gl

LET N l=Hl

LET 01=11

LET P1=J1

LET Q1=K1

LET Rl=Ll

LET Sl=Ml

LET Tl=Nl

LET Ul=01

Ul
2120 LET V1=P1

2130 LET W1=Q1

2140 LET X1=R1

2.150 PRINT " 1.5 ",S1

2160 PRINT "-2.5 " ,T1

2170 PRINT " 3.5 " ,U1

2180 PRINT " 4.

5

" ,V1

2190 PRINT " 5.5 ",W1

2200 PRINT "-6.5 • ,X1

2210 LET Yl=9. 99999

2220 LET Z 1=Y

1

2230 PRINT " 9.99999

2240 PRINT

2250 PRINT " 2260 PRINT

2270 END

END TEST."

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 6

SECTION 6.1.1: SPACE ALLOTMENT (E-FORMAT), COMPACT FORM.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

12 34 56789 012 34 567 890 12 34 567 890 1234 56^8 90 12 34 567890 12 34 567 890 123 4 567890 12

STANDARD OPTIONAL SYSTEM

** 1.23456E32 ** 1.23456E+32 ** 1.23456E+32  -l. 23456E32 ** -l . 234 56E+32 **-l . 23456E+32  -l . 23456E-24 ** -l . 23456E-24 **-l . 234 56E-24   1 . 00000E30 **  1 . 00000E+30 ** 1 . 00000E+30  -9. 87000E-37 ** -9 . 87000E-37 **-9 . 87000E-37 **

END TEST.

SECTION 6.1.2: NR3 CONSTANTS SEPARATED BY SEMICOLONS.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

1 . 00000E+30 -9 . 87000E-37 1.23456E+32

42
-1 . 23456E+32 1.78950E+36 5.00000E-20

END TEST.

SECTION 6.2: ASSIGNED NUMERIC CONSTANTS.

SECTION 6.2.1: ASSIGNMENT OF NRl CONSTANTS.

SECTION 6. 2. 1.1: UNSIGNED CONSTANTS TO A VARIABLE.

NEEDED

OUTPUT

BEGIN TEST.

SYSTEM

OUTPUT

112345

0

112345

0 END TEST.

SECTION 6. 2. 1.2: SIGNED CONSTANTS TO A VARIABLE.

BEGIN TEST.

NEEDED

OUTPUT

SYSTEM

OUTPUT

2 -3

-8765

6912

2 -3

-8765

6912

END TEST.

SECTION 6. 2. 1.3: TRANSITIVE ASSIGNMENT OF AN NRl CONSTANT

BEGIN TEST.

NEEDED

OUTPUT

SYSTEM

OUTPUT

-99999 -99999

END TEST.

SECTION 6.2.2: ASSIGNMENT OF NR2 CONSTANTS.

SECTION 6. 2. 2.1: UNSIGNED CONSTANTS TO A VARIABLE.

NEEDED

OUTPUT

SYSTEM

OUTPUT

1.05 1.05

358.672 358.672

1+3
END TEST

SECTION 6. 2. 2. 2: SIGNED CONSTANTS TO A VARIABLE.

NEEDED SYSTEM

OUTPUT OUTPUT

-2.1 -2.1

3.1 3.1

-2714.25 -2714.25

29.3054 29.3054

SECTION 6. 2. 2. 3: TRANSITIVE

NEEDED SYSTEM

OUTPUT OUTPUT

-9999.99 -9999.99

1.5 1.5

-2.5 -2.5

3.5 3.5

4 .

5

4.5

5.5 5.5

-6.5 -6.5

9.99999 9.99999

BEGIN TEST.

END TEST.

ASSIGNMENT OF AN NR2 CONSTANT.

BEGIN TEST.

END TEST
7.0

ASSIGNMENT OF FLOATING POINT CONSTANTS

This test verifies that signed as well as unsigned NR3 constants can be

assigned to simple variables. It also verifies that the assigned value of an NR3 constant can be cross assigned from one simple variable to another. The

user should refer to section 5, 6, 9, and 12 of BSR X3.60 and observe

that trailing zeroes in the significand are optional.

7.1

Using NR3 Form to Assign NRl and NR2

Constants, both Signed and Unsigned

This test verifies that the NR3 form of constants can be used to

represent numerical constants used in Minimal BASIC program. That is, all

numerical constants should be acceptable in NR3 form as program constants but

on output should be printed in their appropriate form as either NRl or NR2

constants. The test also verifies that a positive number in NR3 form with or without a preceding plus sign can be assigned to a simple variable without

modifying the value of that constant. On output there should be two columns

of numbers. The first column of numbers represents the desired numbers which

can be compared with those outputted in the second column as the evaluated

representation of the system.

7.2

Using NR3 Form to Assign NR3 Constants,

both Signed and Unsigned

The objective of this test is to verify that the positive sign is

optional when representing NR3 constants which cannot be represented in any

other form except NR3. Therefore, this section tests whether there will be

any modification in the numerical representation regardless of whether a plus

sign is in front of the assigned NR3 number. On output there should be two

columns of numbers. The first column of numbers represents the desired

numbers which can be compared with those outputted in the second column as the evaluated representation of the system.

7.3

Cross Assignment of an NR3 Constant

The objective of this test is to sample a number of the allowed

representations for a simple variable to determine that cross assignments of

an NR3 constant will not modify the value of that constant. The test uses 33

of the simple variables: A2, B2, C2, D2, C3, D3, A6, B6, C6, D6, E2, E3, E4,

E6 , F2, F 3 , F 4 , F6, G2, G3, G4, G5, G6, H2, H3, H4, H5, H6, 12, 13, 14, 15,

and 16. The simple variable A2 is initially assigned the NR3 constant and

then the content of A2 is assigned to B2, and then B2 to C2, and then C2 to

D 2 ; and this form assigning continues sequentially through the list of

variables above through 16. The final printed output represents the value of

16 which should be the value of the original NR3 constant assigned to A2.

******************

h5
* PROGRAM FILE 7

*

10 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 LET A

7

210 LET B 7 220 LET C

7

230 LET D7

240 LET E

7

250 LET F

7

260 LET G7

270 LET H

7

280 LET 17

290 PRINT

300 PRINT

310 PRINT

320 PRINT

330 PRINT

340 PRINT

350 PRINT

360 PRINT

370 PRINT

380 PRINT

390 PRINT

400 PRINT

410 PRINT

420 PRINT

430 PRINT

440 PRINT

450 PRINT

460 PRINT

470 PRINT

480 PRINT

490 PRINT

500 PRINT

510 PRINT

520 PRINT

530 LET A8

540 LET B

8

PROGRAM FILE 7"

SECTION 7.0: ASSIGNMENT OF NR3 CONSTANTS."

SECTION 7.1:"

USING NR3 FORM TO ASSIGN NRl AND NR2 CONSTANTS,"

BOTH SIGNED AND UNSIGNED."

BEGIN TEST."

= 1 . 05E02

=-7 . 6E

1

=+332. 4E0

=51. 32E-1

=+5. 34E-3

=-14 . 19E-2

=-9. 9E+2

=+10. 5210E+3

=4. 56E+1

"NEEDED" , "SYSTEM"

"OUTPUT" , "OUTPUT"

105 ",A7

-76 " , B 7 332.4 " , C 7 5.132 ",D7

.00534 ",E7

-.1419 ",F7

-990 ",G7

10521 " , H 7 45.6 " , 1

7

END TEST.

SECTION 7.2:"

USING NR 3 FORM TO ASSIGN NR3 CONSTANTS ONLY,"

BOTH SIGNED AND UNSIGNED."

BEGIN TEST."

=1 . E30

=+123. E20

46
550 LET C8=

560 LET D8 = 570 LET E8=

580 LET F 8 = 590 LET G8=

600 LET H 8 = 610 LET 18=

620 LET A9=

630 LET B9=

640 LET C 9 = 650 LET D9=

660 LET E9=

670 LET F 9 = 680 LET G9=

690 LET H 9 = 700 LET 19=

710 LET Jl=

720 LET J2=

730 LET J 3 = 740 LET J4=

750 LET J 5=

760 LET J 6 = 770 LET J7=

780 LET J 8 = 790 LET J9=

800 PRINT " 810 PRINT

820 PRINT " 830 PRINT " 840 PRINT " 850 PRINT " 860 PRINT " 870 PRINT " 880 PRINT " 890 PRINT " 900 PRINT " 910 PRINT " 920 PRINT " 930 PRINT " 940 PRINT " 950 PRINT " 960 PRINT " 970 PRINT " 980 PRINT " 990 PRINT " 1000 PRINT

1010 PRINT

1020 PRINT

1030 PRINT

1040 PRINT

1050 PRINT

1060 PRINT

1070 PRINT

1080 PRINT

1090 PRINT

1100 PRINT

1110 PRINT

-11.E30

144.E-21

-12. E-22

+3645. E-23

l.E+34

-200. E+21

+99.E+32

. 234E20

-. 3E22

+ . 44E17

. 36E-33

+. 9E-24

-. 10E-25

. 777E+18

-. 29E+31

+. 04E+26

709E35

+81E36

-9E15

627E+27

+53E+19

-4E+28

1463E-29

+2E-37

-355E-19

STANDARD" , "OPTIONAL" , "SYSTEM"

1.00000E30 " II 9 1 . 00000E+30 II , A8

1 . 23000E22 " II 9 1. 23000E+22 n

, B8

-1. 10000E31 " 11 9 -1. 10000E+31 ii ,C8

1. 44000E-19 II 9 "NONE" ,D8

-1. 20000E-21 II 9 "NONE" ,E8

3. 64500E=20 II 9 "NONE" ,F8

1 . 00000E34 " II 9 1 . 00000E+34 ii ,G8

-2 . 00000E23 " II 9 -2. 00000E+23 ii ,H8

9.90000E33 " II 9 9 . 90000E+33 ii ,18

2. 3400 0E 19 " •1 9 2. 34000E+19 ii ,A9

-3.00000E21 " II 9 -3. 00000E+21 ii ,B9

4.40000E16 " •1 9 4. 40000E+16 n ,C9

3. 60000E-34 N

9 "NONE" ,D9

9. 00000E-25 II 9 "NONE" , E9

-1. 00000E-26 It 9 "NONE" ,F9

7 . 77000E17 " H

9 7. 77000E+17 ii ,G9

-2. 90000E30 " ,"-2. 90000E+30 ",H9

4.00000E24 "," 4.00000E+24 ",I9

" 7.09000E37 7.09000E+37 ",J1

" 8.10000E7 8 . 10000E+37 ",J2

"

, n -9. 00000E + 15 ",J3

6 . 27000E + 29 " , J

4

5 . 30000E + 20 " , J 5 ","-4.00000E + 28 " , J 6

"

, "NONE" , J7

"

, "NONE" , J8

"

, "NONE" , J9

"-9. 0000 0E 15

" 6.27000E29

" 5 . 30000E20

"-4 . 00000E28

" 1 . 46300E-26

" 2.00000E-37

"-3. 55000E-17

END TEST II

b7
1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

PRINT

PRINT " PRINT

PRINT " PRINT

PRINT

PRINT " PRINT

LET A2=1.E30

LET B 2=A2

LET C2=B2

LET D2=C 2 LET C 3=D 2 LET D3=C 3 LET A6=D3

LET B6=A6

LET C 6=B 6 LET D6=C6

LET E2=D6

LET E 3=E 2 LET E4=E3

LET E6=E4

LET F2=E6

LET F 3=F2

LET F 4=F3

LET F6=F4

LET G2=F6

LET G3=G 2 LET G4=G 3 LET G5=G 4 LET G6=G5

LET H 2=G6

LET H3=H2

LET H 4 =H 3 LET H 5=H4

LET H 6=H

5

LET I 2=H

6

LET 13=12

LET 14=13

LET 15=14

LET 16=15

PRINT "STANDARD","

PRINT

PRINT " 1.00000E30

PRINT

PRINT " PRINT

END

SECTION 7.3:"

TRANSITIVE ASSIGNMENT OF AN NR3 CONSTANT.

BEGIN TEST."

OPTIONAL" , "SYSTEM"

"," 1. 00000E + 30 " , I 6 END TEST."

II

A******

* SAMPLE OUTPUT * *****************

U8
PROGRAM FILE 7

SECTION 7.0: ASSIGNMENT OF NR3 CONSTANTS.

SECTION 7.1:

USING NR 3 FORM TO ASSIGN NRl AND NR2 CONSTANTS,

BOTH SIGNED AND UNSIGNED.

BEGIN TEST.

NEEDED

OUTPUT

105

-76

332.4

5.132

. 00534

-.1419

-990

10521

45.6

SYSTEM

OUTPUT

105

-76

332.4

5.132

. 00534

-.1419

-990

10521

45.6

END TEST.

SECTION 7.2:

USING NR3 FORM TO ASSIGN NR 3 CONSTANTS ONLY,

BOTH SIGNED AND UNSIGNED.

BEGIN TEST.

STANDARD OPTIONAL SYSTEM

1. 00000E30 1. 00000E+30 1. 00000E+30

1 . 23000E22 1. 23000E+22 1. 23000E+22

-1. 10000E31 -1. 10000E+31 -1. 10000E+31

1. 44000E-19 NONE 1. 44000E-19

-1. 20000E-21 NONE -1. 20000E-21

3. 64500E=20 NONE 3. 64500E-20

1. 00000E34 1 . 00000E+34 1. 00000E+34

-2. 0000 0E 23 -2. 00000E+23 -2. 00000E+23

9. 90000E33 9. 90000E+33 9. 90000E+33

2. 34000E19 2. 34000E+19 2. 34000E+19

-3. 00000E21 -3. 00000E+21 -3 . 00000E+21

4 . 40000E16 4. 40000E+16 4. 40000E+16

3. 60000E-34 NONE 3. 60000E-34

9. 00000E-25 NONE 9. 00000E-25

-1. 00000E-26 NONE -1. 00000E-26

7. 77000E17 7. 77000E+17 7. 77000E+17
-2. 90000E30 -2. 90000E+30 -2. 90000E+30

4. 00000E24 4. 00000E+24 4 . 00000E+24

7.09000E37 7. 09000E+37 7. 09000E+37

8 . 10000E7 8. 10000E+37 8. 10000E + 37

-9. 00000E15 -9. 00000E+15 -9. 00000E+15

6. 27000E29 6. 27000E+29 6. 27000E+29

5. 30000E20 5. 30000E+20 5. 30 0 0 0E + 20

-4. 00000E28 -4. 00000E+28 -4 . 00000E+28

1 . 46300E-26 NONE 1. 46300E-26

2. 00000E-37 NONE 2. 00000E-37

-3. 55000E-17 NONE -3. 55000E-17

END TEST.

SECTION 7.3:

TRANSITIVE ASSIGNMENT OF AN NR3 CONSTANT.

BEGIN TEST.

STANDARD OPTIONAL SYSTEM

1.00000E30 1 . 00000E+30 1 . 00003E+30

END TEST.

50
8.0

TESTING THE MINIMAL LIMITS IN MAGNITUDE OF

NUMERICAL CONSTANTS

The objective of this test is to determine whether nonzero numbers of

six significant digits with absolute values near the endpoints of the

interval IE-38 to 1E38, can be used as print items in the form of numerical

constants or be assigned to simple variables. The standard specifies that

although constants can have an arbitrary number of digits in the exrad, the

implementation-defined range shall be at least IE-38 to 1E+38 (see section

5.4 of BSR X3.60 ). Nonzero constants, whose magnitudes are outside of

the implementation-defined range, are to be diagnosed as errors. There will

be specific error diagnostic tests in later sections. This section

concentrates on keeping within the range IE-38 to 1E38.

8.1

Printing NR3 Constants of Six Significant Digits

That Are Near the Endpoints of: 1E38 to IE-38

The objective of this subsection is to verify that NR3 constants with

absolute values near the endpoints IE-38 or 1E38 can be used as print-items.

8.1.1

Positive Exponent

The objective of this test is to print constants that, in absolute

value, are near the endpoint 1E38. The test uses both positively and

negatively signed NR3 constants. On output there should be three columns of

numbers. The first column should be headed "Standard Form". This heads a list of numbers that should also be printed in the third column, which is

headed "Form of System". Column two is a list of optional output forms for

the NR3 constants.

8.1.2

Negative Exponent

The objective of this test is to execute the printing of NR3 constants

that, in absolute value, are near the endpoint IE-38. The output of this

test is in the same format as that of test 8.1.1.

8.2

Assigning NR3 Constants of Six Significant Digits

That Are Near the Endpoints of: 1E38 to IE-38

The objective of this test is to verify that NR3 constants, whose

absolute values are close to the magnitude of the endpoints IE-38 and 1E38, can be assigned to simple variables. These simple variables are then used as

pr i nt-i terns

.

8.2.1 Positive Exponent

The objective of this test is the same as that

that for this test the NR3 constants are assigned

structures of the two tests are basically the same,

variables used. On output, the format should be

of test 8.1.1, except

to simple variables. The

except for the simple

the same for this test as

51
for test 8.1.1.

8.2.2 Negative Exponent

The objective of this test is the same as that of test 8.1.2, except

that for this test the NR3 constants are assigned to simple variables which

are the print-items used. The structure and output of this test are the same

as those of test 8.2.1.

8.3 Printing and Assigning the Extreme Values

1E+38 and IE-38

8.3.1 As a Print-Item in Numerical Form

The objective of this test is to execute as print-items, in NR3 con- stant form, both the positive and negative cases of IE-38 and 1E38. The test uses a three column formatted output. The first column, titled "Standard

Form", illustrates the expected standard conforming E-formatted output. The

second column, titled "Optional Form", gives another acceptable standard

conforming output for E-formatted constants. Column three, titled "Form of

System", gives the output form used by the system being tested.

8.3.2 As Print-Items Which Have Been Numerically Assigned

The objective of this test is the same as that of test 8.3.1, except

that for this test the positive and negative cases of the endpoints, IE-38

and 1E38, are first assigned to simple numeric variables, and then those

simple variables are used as the print-items. The structure of the test is

the same as that of test 8.3.1. The output format for this test is the same

as the output format for test 8.3.1.

******************

* PROGRAM FILE 8

* ******************

10 PRINT "PROGRAM FILE

60 PRINT

70 PRINT

80 PRINT

90 PRINT " 100 PRINT

110 PRINT

120 PRINT

130 PRINT

140 PRINT

150 PRINT

SECTION 8.0:

SECTION 8.1:

8

"

TESTING THE MAGNITUDE OF NUMERICAL CONSTANTS

WITHIN MINIMAL LIMITS OF IE-38 AND 1E38."

PRINTING NR3 CONSTANTS OF 6 SIGNIFICANT DI-"

GITS WHICH ARE NEAR THE MAGNITUDE OF:"

1 E 3 8

"

II

52
160 PRINT II OR"

170 PRINT II 1 E - 3 8 . " 180 PRINT

190 PRINT

200 PRINT

210 PRINT n SECTION 8.1.1"

220 PRINT

230 PRINT ti (POSITIVE EXPONENT.)"

240 PRINT

250 PRINT

260 PRINT n BEGIN TEST."

270 PRINT

280 PRINT ii ii ii 9 "

, " FORM " 290 PRINT it STANDARD" , "OPTIONAL" , " OF " 300 PRINT ii FORM "

,

FOR ", "SYSTEM"

310 PRINT

320 PRINT it -9. 99999E30 "

, "-9. 99999E+30 " , -9 . 99999E30

330 PRINT n 9. 99999E31 "," 9 . 99999E+31 " , +9. 99999E31

340 PRINT n -9. 99999E32 " ,"-9. 99999E + 3 2 " , -9 . 999 9 9E + 3 2 350 PRINT n 9. 99999E33 "," 9 . 99999E + 33 " , 9 . 99999E33

360 PRINT ii -9. 99999E34 " ,"-9. 99999E + 34 " , -9 . 99999E34

370 PRINT ii 9. 99999E35 "," 9 . 99999E+35 " , +9 . 99999E+35

380 PRINT ii -9. 99999E36 "

, "-9.99999E+36 ", -9 . 99999E+36

390 PRINT ii 9. 99999E37 "," 9.99999E+37 ",9.99999E37

400 PRINT

410 PRINT ii END TEST.

420 PRINT

430 PRINT

440 PRINT

450 PRINT ii SECTION 8.1.2"

460 PRINT

470 PRINT ii (NEGATIVE EXPONENT.)"

480 PRINT

490 PRINT

500 PRINT ii BEGIN TEST."

510 PRINT

520 PRINT ii ll II 9 "

, " FORM " 530 PRINT ii STANDARD" , "OPTIONAL" , " OF n 540 PRINT ii FORM "

, " FORM SYSTEM"

550 PRINT

560 PRINT ii -9. 99999E-30 "

, " NONE" ,-9. 99999E-30

570 PRINT ii 9. 99999E-31 "

, "NONE" , + 9 . 99999E-31

580 PRINT ii -9. 99999E-32 "

, "NONE" ,-9. 99999E-32

590 PRINT ii 9. 99999E-33 "

, "NONE" ,9.99999E-33

600 PRINT ii -9. 99999E-34 " /’NONE" ,-9. 99999E-34

610 PRINT ii 9. 99999E-35 "

, " NONE" , + 9 . 9999 9E -35

620 PRINT ii -9. 99999E-36 " ,"NONE" ,-9. 99999E-36

630 PRINT n 9.99999E-37 "

, "NONE" , 9. 99999E-37

640 PRINT

650 PRINT ii END TEST."

6 60 PRINT

670 PRINT

680 PRINT

690 PRINT it SECTION 8.2: ASSIGNING NR 3 CONSTANTS OF 6 SIGNIFICANT

700 PRINT ii GITS WHICH ARE NEAR THE MAGNITUDE OF

710 PRINT

720 PRINT n 1 E 3 8

"

53
730 PRINT

740 PRINT

750 PRINT

760 PRINT

770 PRINT

780 PRINT

790 PRINT

800 PRINT

810 PRINT

820 PRINT

830 PRINT

840 PRINT

850 PRINT

860 PRINT

870 PRINT

880 PRINT

890 LET A = 900 LET B=

910 LET C=

920 LET D=

930 LET E=

940 LET F=

950 LET G=

960 LET H=

970 PRINT

980 PRINT

990 PRINT

1000 PRINT

1010 PRINT

1020 PRINT

1030 PRINT

1040 PRINT

1050 PRINT

1060 PRINT

1070 PRINT

1080 PRINT

1090 PRINT

1100 PRINT

1110 PRINT

1120 PRINT

1130 PRINT

1140 PRINT

1150 PRINT

1160 PRINT

1170 PRINT

1180 PRINT

1190 LET A

1200 LET B 1210 LET C

1220 LET D 1230 LET E 1240 LET F 1250 LET G

1260 LET H 1270 PRINT

1280 PRINT

1290 PRINT

OR"

IE-38,

SECTION 8.2.1"

(POSITIVE EXPONENT.)"

BEGIN TEST."

"

, " FORM

OF

" FORM " ,

-9 . 99999E30

+9. 99999E31

-9. 99999E+32

9. 99999E33

-9. 99999E34

+9 . 99999E+35

-9 . 99999E+36

9 . 99999E37

"-9.99999E30 ' " 9 . 99999E31 1 "-9.99999E32 ' 9. 99999E33

-9. 99999E34

9 . 99999E35

-9. 99999E36

9. 99999E37

FORM 'SYSTEM"

-9 . 99999E+30 ",A

9 . 99999E+31 ",B

-9 . 99999E+32 ",C

* 9 . 99999E+33 ",D

' -9 . 99999E + 34 " ,

E

' 9 . 99999E+35 ",F

'-9. 99999E+36 ",G

' 9 . 99999E+37 ",H

END TEST.

SECTION 8.2.2"

(NEGATIVE EXPONENT.)"

"STANDARD'

" FORM *

1 "

, " FORM " ’OPTIONAL"," OF "

1 FORM "/’SYSTEM" —9 . 99999E-30

: +9 . 99999E-31

=-9 . 99999E-32

=9. 99999E-33

=-9.99999E-34

: +9 . 99999E-35

: -9 . 99999E-36

=9. 99999E-37

"-9. 99999E-30 ’NONE" ,

A

9 . 99999E-31 "

, " NONE" ,

B

'-9 . 99999E-32 ’NONE" ,C

5 U
1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1 7 40

1750

1760

1770

1 7 80

1790

1800

1810

1820

1830

1840

1850

1860

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET A' LET B> LET C' LET D* PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

" 9 . 99999E-33 "

, " NONE" ,

D

"-9. 99999E-34 ","NONE",E

" 9 . 99999E-35 ","NONE",F

"-9. 99999E-36 "

,

n NONE" ,

G

" 9 . 99999E-37 ","NONE",H

END TEST."

"SECTION 8.3: PRINTING/ASSIGNING THE EXTREMES OF THE NR 3"

" (FORM) CONSTANTS."

SECTION 8.3.1"

(AS A PRINT ITEM IN CONSTANT FORM , NUMERICALLY.)"

BEGIN TEST."

"STANDARD*

" FORM

"

, " FORM

, OF

FORM ", "SYSTEM"

" 1.00000E36 1.00000E+38 ",1.00000E38

" 1.00000E-38 " ,"NONE" , 1. 00000E-38

"-1.00000E38 " ,"-l. 00000E+38 " , -1 . 00000E+38

"-1. 00000E-38 " ,"NONE" ,-l. 00000E-38

" END TEST."

SECTION 8.3.2"

(AS A PRINT ITEM WHICH HAS BEEN NUMERICALLY ASSIGNED.)"

BEGIN TEST."

"STANDARD" , "OPTIONAL" , " OF

FORM II II i FORM 'SYSTEM"

! 1 . 00000E 38

'1. 00000E-38

-1. 00000E+38

-1 . 00000E-38

" 1.00000E38 1.00000E+38 ",A

" 1.00000E-38 "

, " NONE" ,

B

"-1.00000E38 "

, "-1 . 00000E+38 ",C

"-1. 00000E-38 "

, " NONE" ,

D

END TEST."

55
1870 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 8

SECTION 8.0: TESTING THE MAGNITUDE OF

WITHIN MINIMAL LIMITS OF

NUMERICAL CONSTANTS

IE-38 AND IE 38

.

SECTION 8.1: PRINTING NR3 CONSTANTS OF 6 SIGNIFICANT DIGITS WHICH ARE NEAR THE MAGNITUDE OF:

IE 38

OR

IE-38.

SECTION

(POSITIVE

8 . 1.1

EXPONENT.

)

BEGIN TEST.

STANDARD

FORM

-9. 99999E30

9. 99999E31

-9. 99999E32

9. 99999E33

-9. 99999E34

9. 99995E35

-9. 99999E36

9. 99999E37

OPTIONAL

FOR

-9. 99999E+30

9. 99999E+31

-9. 99999E+32

9 . 99999E+33

-9. 99999E+34

9. 99999E+35

-9. 99999E+36

9. 99999E+37

FORM

OF

SYSTEM

-9. 99999E+30

9. 99999E+31

-9. 99999E+32

9. 99999E+33

-9. 99999E+34

9. 99999E + 35

-9. 99999E+36

9. 99999E+37

END TEST.

SECTION 8.1.2

(NEGATIVE EXPONENT.)

56
BEGIN TEST.

FORM

STANDARD OPTIONAL OF

FORM FORM SYSTEM

-9. 99999E-30 NONE -9. 99999E-30

9. 99999E-31 NONE 9. 99999E-31

-9. 99999E-32 NONE -9. 99999E-32

9. 99999E-33 NONE 9. 99999E-33

-9. 99999E-34 NONE -9. 99999E-34

9. 99999E-35 NONE 9. 99999E-35

-9. 99999E-36 NONE -9. 99999E-36

9. 99999E-37 NONE 9. 99999E-37

END TEST.

SECTION 8.2: ASSIGNING NR3 CONSTANTS OF 6 SIGNIFICANT DIGITS WHICH ARE NEAR THE MAGNITUDE OF:

1E38

OR

IE-38

.

SECTION 8.2.1

(POSITIVE EXPONENT.)

BEGIN TEST.

FORM

STANDARD OPTIONAL OF

FORM FORM SYSTEM

-9. 99999E30 -9. 99999E+30 -9. 99999E+30

9. 99999E31 9. 99999E+31 9. 99999E+31

-9. 99999E32 -9. 99999E+32 -9. 99999E+32

9. 99999E33 9. 99999E+33 9. 99999E+33

-9. 99999E34 -9. 99999E+34 -9. 99999E+34

9. 99999E35 9. 99999E+35 9. 99999E+35

-9. 99999E36 -9. 99999E+36 -9. 99999E+36

9. 99999E37 9. 99999E+37 9. 99999E+37

END TEST.

SECTION 8.2.2

(NEGATIVE EXPONENT.)

57
FORM

STANDARD OPTIONAL OF

FORM FORM SYSTEM

-9 . 99999E-30 NONE -9. 99999E-30

9 . 99999E-31 NONE 9. 99999E-31

-9. 99999E-32 NONE -9. 99999E-32

9. 99999E-33 NONE 9. 99999E-33

-9. 99999E-34 NONE -9. 99999E-34

9 . 99999E-35 NONE 9. 99999E-35

-9 . 99999E-36 NONE -9. 99999E-36

9. 99999E-37 NONE 9. 99999E-37

END TEST.

SECTION 8.3: PRINTING/ASSIGNING THE EXTREMES OF THE NR3

(FORM) CONSTANTS.

SECTION 8.3.1

(AS A PRINT ITEM IN CONSTANT FORM, NUMERICALLY.)

STANDARD

FORM

1. 00000E38

1. 00000E-38

-1. 00000E38

-1. 00000E-38

OPTIONAL

FORM

1 . 00000E+38

NONE

-1. 00000E+38

NONE

BEGIN TEST.

FORM

OF

SYSTEM

1. 00000E+38

1. 00000E-38

-1. 00000E+38

-1. 00000E-38

END TEST.

SECTION 8.3.2

(AS A PRINT ITEM WHICH HAS BEEN NUMERICALLY ASSIGNED.)

STANDARD

FORM

1. 00000E38

1. 00000E-38

-1. 00000E38

-1. 00000E-38

OPTIONAL

FORM

1. 00000E+38

NONE

-1 . 00000E+38

NONE

BEGIN TEST.

FORM

OF

SYSTEM

1. 00000E+38

1. 00000E-38

-1. 00000E+38

-1.00000E-38

58
END TEST.

59
9.0

THE REM AND GOTO STATEMENTS

The objectives of this test are two-fold in that they test the REM and

GOTO-statements both separately and together. The REM statement is tested

for the requirement that it allow the use of any characters in the ASCII

character set for BASIC in its REM-string . The GOTO-statement is tested for

its unconditional transferability. This section begins the evaluation of the

host system's control structure with the most primitive BASIC control

statement. The user should refer here to sections 10 and 18 and the syntax

of a remark-string in section 3.2 of BSR X3.60.

9.1

REM-Statement as a Program Annotator

The objective of this test is to use all of the ASCII allowed Minimal

BASIC string-characters within a remark-string. This character set consists

of the set of upper-case Roman letters referenced by the ASCII character set

in positions 4/1 through 5/10, the set of Arabic digits referenced by the

ASCII character set in positions 3/0 through 3/9 and the remaining

string-characters. The remaining string-characters consist of the following

characters: space, exclamation-point, number-sign, dollar, percent,

ampersand, quote, apostrophe, open-parenthesis, close-parenthesis, asterisk,

plus, comma, minus, period, slant, colon, semicolon, less-than, equals,

greater-than, question-mark, circumflex, and underline. The test uses each

of the characters described above in REM strings. On output, there must be

only one printed statement between the beginning of the test and its end with

two blank lines above it and one below it.

9.2

GOTO Statement with a Single Space Between GO and TO

The objective of this test is to test the transfer capability of the

unconditional GOTO-statement. This transfer capability is tested for both

forward and backward transferring. In testing the forward and backward

transferring capabilities of the GOTO-statements, the transfers are made to

both adjacent and non-adjacent line numbers. Along with these transfers

there is also a test of the capability of the GOTO-statement to carry with

its transfers any numeric values that may be requested , i.e. there is a test to verify that assigned variables are global. In this test section,

only a single space is used between the GO and TO in the keyword. On output

there should be numerically ordered printing of the digits 1, 2, ...» 8 for

each successful transfer by the GOTO-statements. There are also error traps

in the test. Should a transfer be unsuccessful, with no diagnostic and

execution continuing at the next statement, then a printout of the attempted

line transfer, just prior to the halting of execution, will appear.

9.3

GOTO Statement with Many Spaces Between GO and TO

The objective here is to test the use of an arbitrary number of spaces

within the keyword between the GO and the TO of the GOTO-statement. The test

also verifies that although the REM-statement has no effect when executed, it can serve as a statement to which control is transferred.

60
The output for this test should be the same as traps are also a part of this test for any faulty

printout for any errors will be the same as specified

for test 9.2.

transfer attempts

for test 9.2.

Er r or The

9.4 GOTO Statement with a Transfer to a GOTO

The objective of

transfer capability

another GOTO-statement

incorrect transfers,

requested, but failed,

the status of the test

this test is to verify further the uncondit

of the GOTO-statement, which in this test transfe

The test has error messages printed if there ar These messages will indicate which transfers

On output there should be a statement to the use

ional

r s to

e any were

r on

* PROGRAM FILE 9

* ******************

40

50

60

70

80

90

100

110

120

130

140

150

160

170

180

190

200

210

220

230

240

250

260

270

280

290

SECTION 9.1: REM-STATEMENT , AN ANNOTATOR,

BEGIN TEST."

1 PRINT "PROGRAM FILE 9"

2 PRINT

3 PRINT

4 PRINT

30 PRINT " PRINT

PRINT " PRINT

REM THIS TEST SECTION TESTS THE REM STATEMENT.

REM ALL THE MINIMAL BASIC CHARACTER SET OF THE ASCII

REM SET ARE GIVEN BELOW.

REM

REM ABCDEFGHI JKLMNOPQRSTUVWXYZ * () %_

REM 70123456789 " !#$& ; <=>~ REM

PROGRAM FLOW SHOULD NOT BE ALTERED BY REM STATEMENTS

CHARACTER

REM THE

REM

PRINT

PRINT " PRINT

PRINT " PRINT

PRINT " PRINT

PRINT " PRINT

PRINT " GO TO 430

PRINT " LET M=3

PRINT TAB (30) ;M

IF THIS LINE ONLY PRINT, REM TEST PASSES."

END TEST."

SECTION 9.2: GOTO-STATEMENT, SINGLE SPACED."

BEGIN TEST."

IF A ONE FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED.

ERROR, TRANSFER FROM LINE 260 TO 430 IMPROPER."

6l
300

310

320

330

340

350

360

370

380

390

400

410

420

430

440

4 50

460

470

480

490

500

505

510

520

530

540

550

560

570

580

590

600

610

620

630

640

650

660

670

680

690

700

710

720

730

740

750

760

770

780

790

800

810

820

830

840

850

PRINT " IF A FOUR FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED."

GO TO 580

PRINT " ERROR, TRANSFER FROM LINE 310 TO 580 IMPROPER."

LET M=7

PRINT TAB (30) ;M PRINT " IF AN EIGHT FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED."

GO TO 480

PRINT " ERROR, TRANSFER FROM LUNE 360 TO 480 IMPROPER."

LET M=2

PRINT TAB (30) ;M PRINT " IF A THREE FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED."

GO TO 280

PRINT " ERROR, TRANSFER FROM LINE 410 TO 280 IMPROPER."

LET M=1

PRINT TAB (30) ;M PRINT " IF A TWO FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED."

GO TO 380

PRINT " ERROR, TRANSFER FROM LINE 460 TO 380 IMPROPER."

LET M=8

PRINT TAB (30) ;M PRINT " IF A MESSAGE ON OUTPUT SHOULD FOLLOW THIS PARAGRAPH,"

PRINT "THEN FORWARD TRANSFER PERFORMED."

GO TO 680

PRINT " ERROR, TRANSFER FROM LINE 510 TO 680 IMPROPER."

LET M=6

PRINT TAB (30) ;M PRINT " IF A SEVEN FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED.

GO TO 330

PRINT " ERROR, TRANSFER FROM LINE 560 TO 330 IMPROPER."

LET M=4

PRINT TAB (30) ;M PRINT " IF A FIVE FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED.

GO TO 630

PRINT " ERROR, TRANSFER FROM LINE 610 TO 630 IMPROPER."

LET M=5

PRINT TAB (30) ;M PRINT " IF A SIX FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED.

GO TO 530

PRINT " PRINT " PRINT

PRINT " PRINT

PRINT " PRINT

PRINT " PRINT

PRINT " GOTO 970

PRINT " ERROR, TRANSFER FROM LINE 770 TO 970 IMPROPER."

REM CONTROL TRANSFERED BACKWARDS TO THIS STATEMENT.

LET M=3

ERROR, TRANSFER FROM LINE 660 TO 530 IMPROPER."

THE ABOVE PRINTOUT SHOULD BE IN THE ORDER 1,2,..., 8. END TEST.

SECTION 9.3: GOTO-STATEMENT , ANY SPACE/REM."

BEGIN TEST.

IF A ONE FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED.

PRINT TAB (30) ;M PRINT " IF A FOUR FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED."

GO TO 1150

PRINT " ERROR, TRANSFER FROM LINE 830 TO 1150 IMPROPER.

REM CONTROL TRANSFERED BACKWARDS TO THIS STATEMENT.

62
860 LET M=7

870 PRINT TAB (30) ;M 880 PRINT " IF AN EIGHT FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED.

890 GO TO 1030

900 PRINT " ERROR, TRANSFER FROM LINE 890 TO 1030

910 REM CONTROL TRANSFERED BACKWARDS TO THIS STATEMENT."

920 LET M=2

930 PRINT TAB (30) ;

M

940 PRINT " IF A THREE FOLLOWS THIS LINE, BACKWARD TRANSFER

950 GO TO 790

960 PRINT " ERROR, TRANSFER FROM

970 REM CONTROL TRANSFERED FORWARD TO THIS

980 LET M=1

990 PRINT TAB (30) ;MA TWO FOLLOWS THIS LINE,

IMPROPER.

PERFORMED.

LINE 950 TO

STATEMENT.

790 IMPROPER.

1000 PRINT " IF

1010 GO TO 910

1020 PRINT It 1030 REM CONTROL 1 1040 LET M =: 8 1050 PRINT TAB (30

1060 PRINT II 1065 PRINT "THEN

1070 GO

1080 PRINT II 1090 REM CONTROL 1 1100 LET M =6

1110 PRINT TAB (30

1120 PRINT " IF A

1130 GO

1140 PRINT II 1150 REM CONTROL 1 1160 LET M =: 4 1170 PRINT TAB (30

1180 PRINT " IF

1190 GO TO

1200 PRINT II 1210 REM CONTROL ' 1220 LET M == 5 1230 PRINT TAB (30

1240 PRINT " IF

1250 GO 1 1260 PRINT II 1270 REM CONTROL ' 1280 PRINT II 1290 PRINT

1300 PRINT II 1310 PRINT

1320 PRINT

1330 PRINT II 1340 PRINT

1350 PRINT II 1360 PRINT

1370 GO TO 1440

1380 PRINT II 1390 PRINT II 1400 GO TO 1460

1410 PRINT II

BACKWARD TRANSFER PERFORMED

ERROR, TRANSFER FROM LINE 1010 TO 910 IMPROPER.

TRANSFERED FORWARD TO THIS STATEMENT.

IF A MESSAGE ON OUTPUT SHOULD FOLLOW THIS PARAGRAPH,"

FORWARD TRANSFER PERFORMED."

TO 1270

ERROR, TRANSFER FROM LINE 1070 TO 1270 IMPROPER

TRANSFERED BACKWARDS TO THIS STATEMENT.

) ?M

SEVEN FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED

TO 850

ERROR, TRANSFER FROM

TRANSFERED FORWARD TO THIS

LINE 1130

STATEMENT.

TO 850 IMPROPER.

A FIVE FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED

1210

ERROR, TRANSFER FROM

TRANSFERED FORWARD TO THIS

LINE 1190 TO

STATEMENT.

1210 IMPROPER

A SIX FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED

TO 1090

ERROR, TRANSFER FROM LINE 1250 TO

TRANSFERED FORWARD TO THIS STATEMENT.

THE ABOVE PRINTOUT SHOULD BE IN THE ORDER

1090 IMPROPER

1 , 2 , END TEST.

SECTION 9.4: GOTO-STATEMENT , TRANSFER TO A GOTO

BEGIN TEST."

ERROR, TRANSFER FROM LINE 1370 TO 1440 IMPROPER

IF NO ERROR MESSAGES, TEST PASSED."

ERROR, TRANSFER FROM LINE 1400 TO 1460 IMPROPER
1420 GO TO 1390

1430 PRINT II ERROR, TRANSFER FROM LINE 1420 TO 1390 IMPROPER.

1440 GO TO 1420

1450 PRINT u ERROR, TRANSFER FROM LINE 1440 TO 1420 IMPROPER.

1460 PRINT

1470 PRINT ii END TEST. II 1480 PRINT

1500 END

* SAMPLE OUTPUT * *******

PROGRAM FILE 9

SECTION 9.1: REM-STATEMENT , AN ANNOTATOR.

BEGIN TEST.

IF THIS LINE ONLY PRINT, REM TEST PASSES.

END TEST.

SECTION 9.2: GOTO-STATEMENT , SINGLE SPACED.

BEGIN TEST.

IF A ONE FOLLOWS THIS LINE , FORWARD TRANSFER PERFORMED.

IF A TWO FOLLOWS THIS LINE,

iBACKWARD

7 TRANSFER PERFORMED.

IF A THREE FOLLOWS THIS LINE,

zBACKWARD TRANSFER PERFORMED.

IF A FOUR FOLLOWS THIS LINE , FORWARD

A TRANSFER PERFORMED.

IF A FIVE FOLLOWS THIS LINE , FORWARD

c TRANSFER PERFORMED.

IF A SIX FOLLOWS THIS LINE,

JBACKWARD TRANSFER PERFORMED.

IF A SEVEN FOLLOWS THIS LINE,

DBACKWARD

7 TRANSFER PERFORMED.

IF AN EIGHT FOLLOWS THIS LINE , FORWARD TRANSFER PERFORMED.

8 IF A MESSAGE ON OUTPUT SHOULD FOLLOW THIS PARAGRAPH,

THEN FORWARD TRANSFER PERFORMED.

THE ABOVE PRINTOUT SHOULD BE IN THE ORDER 1,2,..., 8.

6b
END TEST.

SECTION 9.3: GOTO-STATEMENT , ANY SPACE/REM.

BEGIN TEST.

IF A ONE FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED.

1 IF A TWO FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED.

2 IF A THREE FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED.

3 IF A FOUR FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED.

4 IF A FIVE FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED.

5 IF A SIX FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED.

6 IF A SEVEN FOLLOWS THIS LINE, BACKWARD TRANSFER PERFORMED.

7 IF AN EIGHT FOLLOWS THIS LINE, FORWARD TRANSFER PERFORMED.

8 IF A MESSAGE ON OUTPUT SHOULD FOLLOW THIS PARAGRAPH,

THEN FORWARD TRANSFER PERFORMED.

THE ABOVE PRINTOUT SHOULD BE IN THE ORDER 1,2,..., 8. END TEST.

SECTION 9.4: GOTO-STATEMENT, TRANSFER TO A GOTO.

BEGIN TEST.

IF NO ERROR MESSAGES, TEST PASSED.

END TEST.

65
10.0 TEST FOR GOTO WITH ILLEGAL STATEMENT LABEL

The objective of this test is to verify that the execution of a GOTO-statement , which refers to a non-existent line, will cause program

execution to be suspended by the system. As specified in section 10.4 of BSR

X3.60 all line-numbers in control statements must refer to lines in the

program. In order to continue, this program will require some user-oriented

restart procedure but this would be implementation dependent. The structure

of this test is specifically constructed with a GOTO-tr ansfer to a non-existent line number in order to determine whether the system

implementation detects and processes this error. There should be some form

of implementation defined diagnostic printed upon execution attempt of this

program.

* PROGRAM FILE 10 *

10 PRINT " P 60 PRINT

70 PRINT

80 PRINT

90 PRINT " 100 PRINT

110 PRINT

120 PRINT

130 PRINT It 140 PRINT II 150 PRINT If 160 PRINT II 170 PRINT II 180 PRINT

190 PRINT

200 PRINT

210 PRINT II 220 PRINT

230 GOTO 89

240 PRINT II 250 PRINT

260 PRINT II 270 PRINT

280 END

PROGRAM FILE 10"

SECTION 10.0: FATAL ERROR CHECK ON GOTO-STATEMENT .

THIS SECTION HAS AS ITS OBJECTIVE TO USE A GOTO-STATE-"

WHICH REFERS TO A NON-EXISTENT LINE-NUMBER. IF THE"

2M RECOGNIZES THIS AS A FATAL ERROR (THAT IS, SUSPEND-"

BEGIN TEST."

END TEST."

66
*****************

* SAMPLE OUTPUT * *****************

This program requires a diagnostic. Since these are dependent no universal diagnostic statement can be illustrated

following message illustrates the problem in the program and i only as an example:

? UNDEFINED LINE NUMBER 89 IN LINE 230

i mplementat ion

However the

s given here

67
11.0

THE IF-THEN STATEMENT USED TO COMPARE

POSITIVE NUMERICAL CONSTANTS

This test not only performs standard conforming executions of the

IF-THEN statement, but also tests the relation operations. The IF-THEN

statement allows interruption of the normal sequence of execution of

statements. It causes execution to continue at a specified line, rather than

at the one with the next higher line number. The syntax of the IF-THEN

statement has the general form: IF expl rel exp2 THEN line-number. Expl and

exp2 are numeric expressions or string expressions. Rel is any of the

following relational operators: <, <=, =, <>, >=, or >. Equality in this

test means strict equality rather than "approximate equality." Each test of

the relation between expl and exp2 is designed to test both the true and

false case of the IF- THEN statement. This is done by: (1) testing the

IF-THEN statement against known true cases, and (2) against known false cases. Since there is no collating sequence specified by the standard,

string comparisons are made only for = and <>.

All output for the IF-THEN test is formatted as a truth table. There

are three headings for the output of each test. The first heading, "Assigned

Values", labels the column of numbers that are being assigned to variables

for comparison. The second heading, "Comparison of", labels the column of

illustrative comparisons used in the IF-THEN statements. The third heading,

"Truth Table", labels the symbols =, <, >, <>, >=, and <= used in the IF-THEN

comparisons. Each of these symbols forms a column of comparative results in

the truth table by the system's evaluations of the IF-THEN comparisons. The

entries in the truth table are either T, F, or X, where X means that a comparison failed to yield the proper truth result. The truth table output

is used in the next several tests. The user should refer to section 10 of

BSR X3.60-**** for the proper specifications.

11.1

GO TO Transfer to an IF-THEN

The objective of this test is to extend the capability of the

GOTO-statement . In fact the test requires the processor to perform a transfer to an IF-THEN statement by a GOTO-statement. Only a fail message

can be printed. No other output will be generated if the transfer is

per formed

.

11.2

IF-THEN Comparison of a Positive Numerical Constant

with a Positive Numerical Constant

The objectives of the next two tests are simply to compare the values of

positive numbers.

11.2.1 Equal Case

This test shows that the comparison of a positive numerical value with

itself will be properly assigned a truth value by the IF- THEN statement for

each of the relation symbols =, <, >, <>, >=, and <=. This test prints three

possible outputs in the truth table. An "F" or a "T" indicates that the

IF-THEN statement has made a correct evaluation where appropriate and

performed the proper transfer. An "X" indicates that an incorrect evaluation

68
has been made and program flow continued at the next higher line number. For

this test the program supplies the truth values in the first row of the truth

table in the sample output for PROGRAM FILE 11.

11.2.2 Unequal Case

The objective of this test is to show that the comparison of a positive

numerical value with another positive value, not of equal magnitude, will be

properly made by the IF-THEN statement for each of the relation symbols: =,

<, >, <>, >=, and <= . This test supplies the information needed in the

second row of the table in the sample output.

11.3

IF-THEN Comparison of a Positive Number with a Negative Number

The objective of this test is to show that the comparison of a positive

numerical value with a negative value, of the same absolute value, will be

properly made by the IF-THEN statement for each of the relation symbols =, <,

>, <>, >=, and <= . The output for this test is in the third row of the

truth table in the sample output.

11.4

IF-THEN Comparison of a Negative Number with a Positive Number

The objective of this test is to show that the comparison of a negative

numerical value with a positive value, not of the same absolute value, will

be properly made by the IF-THEN statement for each of the relation symbols =,

<, >, <>, >=, and <= . This test prints output in the fourth row of the

truth table.

11.5

IF-THEN Comparison of a Positive Number with Zero

The objective of this test is to show that the comparison of a positive

numerical value with zero will be properly made by each of the relation

symbols =, <, s

, <>, >=, and <= . This test prints its results in the fifth

row of the truth table.

11.6

IF-THEN Comparison of Zero with a Positive Number

The objective of this test is to show that the comparison of zero when

compared with a positive value will be properly made for each of the relation

symbols = , <, >, <>, >=, and <= . The test output lies in the sixth row of

the truth table.

11.7

IF-THEN Comparison of Zero with Zero

The objective of this test is to show that the comparison of zero itself

with zero will be properly made by the IF-THEN statement for each of the

relation symbols =, <, >, <>, >=, and <= . The test output lies in the

seventh row of the truth table.

6 9
* PROGRAM FILE 11 * ********

BEGIN TEST.

10 PRINT "PROGRAM FILE 11"

60 PRINT

70 PRINT

80 PRINT

90 PRINT " 100 PRINT

110 LET A$="="

120 LET B ? = " <

130 LET C$=">"

140 LET D $ = " < >

150 LET E $ = " > = " •

. 160 LET F$=" <=

170 LET A=1

180 LET B=2

190 LET C=3

200 LET L=-l

210 LET X=-2

220 LET Y=3

230 LET Z = 0 240 PRINT "ASSIGNED" ;TAB (20) ; "COMPARISON OF " ; TAB ( 5 4 ) ; "TRUTH TABLE"

250 PRINT " VALUES " ; TAB ( 4 4 ); A $ ; TAB ( 4 9 ); B $ ; TAB ( 5 4 ) ; C $ ;TAB ( 5 9 ) ; D$

;

260 PRINT TAB (65) ; E $ ; TAB (70) ; F

$

270 PRINT

280 REM

290 REM *** THE FIRST SECTION, 11.1, IS AN INTIAL TEST OF A ***

300 REM * * *GOTO TRANSFER TO AN IF-THEN STATEMENT WHICH IS VITAL***

310 REM * **TO ERROR MESSAGES IN THE TESTS OF THE IF-THEN. *** 320 REM

330 REM SECTION 11.1: GOTO/IF-THEN.

340 GOTO 420

350 PRINT

360 PRINT

370 PRINT

380 REM

390 REM

400 REM

410 REM

420 IF 4=4 THEN 510

430 LET A $ = " X

440 GOTO 520

450 LET B $ = " X

460 GOTO 580

470 LET C$="X"

480 GOTO 600

490 LET D$=" X"

500 GOTO 670

510 LET A $ = " T

520 IF 4<=4 THEN 630

530 LET F$=" X"

GOTO TRANSFER TO IF-THEN, FAILED."

PLUS"

CONTINUED TEST OF IF-THEN, MAY HAVE INVALID ERROR MESSAGES."

SECTION 11.2: IF-THEN/POS. VS. POS.

SECTION 11.2.1: EQUAL CASE.

70
540 GOTO 640

550 LET E$=" T"

560 IF 4 <4 THEN 450

570 LET B $ = " F

580 IF 4 >4 THEN 470

590 LET C $ = " F

600 IF 404 THEN 490

610 LET D$=" F"

620 GOTO 670

630 LET F $ = " T

640 IF 4>=4 THEN 550

650 LET E $ = " X

660 GOTO 560

670 PRINT " A = 1 " ;TAB (23) ; "4 TO 4

" ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ) ; B $ ; TAB ( 5 4

)

680 PRINT C $ ; TAB (59) ; D $ ; TAB (65) ; E $ ; TAB (70) ; F $

690 REM

700 REM SECTION 11.2.2: NOT EQUAL CASE.

710 IF A <B THEN 800

720 LET B $ = " X

730 GOTO 810

740 LET A $ = " X

750 GOTO 870

760 LET C$="X"

770 GOTO 890

780 LET E $ = " X

790 GOTO 960

800 LET B $ = " T

810 IF AOB THEN 920

820 LET D$="X"

830 GOTO 930

840 LET F$="T"

850 IF A=B THEN 740

860 LET A$=" F"

870 IF A>B THEN 760

880 LET C $ = " F

890 IF A>=B THEN 780

900 LET E $ = " F

910 GOTO 960

920 LET D$="T"

930 IF A<=B THEN 840

940 LET F $ = " X

" 950 GOTO 850

960 PRINT " B = 2 ";TAB(23);"A TO B " ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ) ; B $ ; TAB ( 5 4

)

970 PRINT C$;TAB (59) ;D$;TAB (65) ;E$;TAB (70) ;F$

980 REM

990 REM SECTION 11.3: IF-THEN/POS. VS. NEG.

1000 IF ON THEN 1090

1010 LET C$="X"

1020 GOTO 1100

1030 LET A $ = " X

" 1040 GOTO 1160

1050 LET B $ = " X

1060 GOTO 1180

1070 F $ = " X

1080 GOTO 1250

1090 LET C $ = " T

1100 IF C >=N THEN 1210

71
1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

LET E $ = " X

GOTO 1220

LET D$= "T"

IF C=N THEN 1030

LET A $ = " F

IF C <N THEN 1050

LET B $ = " F

IF C <=N THEN 1070

LET F $ = " F

GOTO 1250

LET E$="T"

IF CON THEN 1130

LET D$=" X"

GOTO 1140

PRINT " C = 3 " ;TAB (23) ; "C TO M " ; TAB (44) ; A $ ; TAB (49) ; B $ ; TAB (54)

PRINT C$;TAB (59) ; D$ ; TAB (65) ;E$;TAB (70) ;F$

REM

REM SECTION 11.4: IF-THEN/NEG. VS. POS

.

IF XOY THEN 1380 ' « LET D $ = " X

GOTO 1390

LET A $ = ,! X

" GOTO 1450

LET C$="X"

GOTO 14 7 0 LET E $ = " X

GOTO 1540

LET D$="T"

IF X<Y THEN 1500

LET B $ = " X

GOTO 1510

LET F $ = " T

IF X=Y THEN 1320

LET A $ = ” F

IF X>Y THEN 1340

LET C $=" F"

IF X> =Y THEN 1360

LET E$=" F" GOTO 1540

LET B5="T"

IF X<=Y THEN 1420

LET F $ = " X

GOTO 1430

PRINT " N=-3 " ;TAB (23) ; "X TO Y " ; TAB (4 4 ) ; A$ ;TAB ( 4 9

]

PRINT C $ ; TAB (59) ;D$;TAB(65) ;E$;TAB(70) ; F

$

REM

REM SECTION 11.5: IF-THEN/POS. VS. ZERO.

IF 2>=Z THEN 1670

LET E$="X"

GOTO 1680

LET A $ = " X

GOTO 1 7 4 0 LET B$="X"

GOTO 1 7 6 0 LET F $ = " X

GOTO 1830

LET E$= M T"

;B$;TAB (54)

72
1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

1980

1990

2000

2010

2020

2030

2040

2050

2060

2070

2080

2090

2100

2110

2120

2130

2140

2150

2160

2170

2180

2190

2200

2210

2220

2230

2240

IF 2>Z THEN 1790

LET C$="X"

GOTO 1800

LET D$="T"

IF 2=Z THEN 1610

LET A $ = " F

IF 2<Z THEN 1630

LET B $ = " F

IF 2<=Z THEN 1650

LET F $ = " F

GOTO 1830

LET C $ = " T

IF 2<>Z THEN 1710

LET D $ = " X

GOTO 1720

PRINT " X=-2 " ; TAB (23) ; " 2 TO Z " ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ); B $ ; TAB ( 5 4 )

;

PRINT C $ ; TAB ( 59 ) ;D$;TAB(6 5) ;E$;TAB(70) ;F$

REM

REM SECTION 11.6: IF-THEN/ZERO VS. POS

.

IF 0 <=A THEN 1960

LET F $ = " X"

GOTO 1970

LET A$=" X"

GOTO 2030

LET C$="X"

GOTO 2050

LET E $ = 11 X

" GOTO 2120

LET F $ = " T

IF 0<A THEN 2080

LET B $ = " X

GOTO 2090

LET D $ = " T

IF 0=A THEN 1900

LET A $ = " F

IF 0 >A THEN 1920

LET C$="F"

IF 0 >=A THEN 1940

LET E $ = " F

GOTO 2120

LET B$=" T"

IF 0 < >A THEN 2000

LET D $ = " X

GOTO 2010

PRINT " Y=3 " ;TAB (23) ; "0 TO A" ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ) ; B $ ; TAB ( 5 4 )

;

PRINT C$;TAB (59) ;D$;TAB (65) ;E$;TAB (70) ;F$

REM

REM SECTION 11.7; IF-THEN/ZERO VS. ZERO.

IF Z = 0 THEN 2250

LET A $ = " X

GOTO 2260

LET B $ = " X

" GOTO 2320

LET C$="X"

GOTO 2340

LET D $ = " X

GOTO 2410

73
2250 LET A $ = " T

2260 IF Z>=0 THEN 2370

2270 LET E $ = " X

2280 GOTO 2380

2290 LET F $ = " T

2300 IF Z>0 THEN 2190

2310 LET B $ = " F

2320 IF Z<0 THEN 2210

2330 LET C $ = " F

2340 IF ZO0 THEN 2230

2350 LET D$=" F"

2360 GOTO 2410

2370 LET E $ = " T

2380 IF Z<=0 THEN 2290

2390 LET F$=" X"

2400 GOTO 2300

2410 PRINT " Z=0 II .

i 2420 PRINT C $ ; TAB (59) ; 2430 PRINT

2440 PRINT " IF NO

2450 PRINT "THE SYSTEM

2460 PRINT

2470 PRINT " 2480 END

; TAB (23) ; " Z TO 0

" ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ) ; B $ ; TAB ( 5 4

)

X(S) APPEARED IN

PASSED THE TEST.

THE ABOVE TRUTH TABLE, THEN"

END TEST.

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 11

BEGIN TEST.

ASSIGNED COMPARISON OF TRUTH1 TABLE

VALUES = < s <> > = < A = 1 4 TO 4 T F F F T T

B = 2 A TO B F T F T F T

C = 3 C TO N F F T T T F N=-3 X TO Y F T F T F T

X=-2 2 TO Z F F T T T F

Y = 3 0 TO A F T F T F T

Z = 0 Z TO 0 T F F F T T

IF NO X(S) APPEARED IN THE ABOVE TRUTH TABLE , THEN

THE SYSTEM PASSED THE TEST.

7lj
END TEST.
12.0

THE IF-THEN STATEMENT USED TO COMPARE NEGATIVE

NUMERICAL CONSTANTS

12.1

IF-THEN Comparison of a Negative Number with a Negative Number

The objective of this subsection is to compare two negative numerical

values by the IF-THEN statement12.1.1 (see section 10 of BSR X3.60).

Equal Case

The objective of this test is to show that the proper comparison of a negative numerical value with itself will be made by the IF-THEN statement

for each of the relation symbols =, <, N

, <> , > = , and <= . The test output

is in the first row of the truth table in the sample output for PROGRAM FILE

12 .

12.1.2

Unequal Case

The objective of this test is to show that the proper comparison of a negative numerical value with another negative value, not of the same magnitude, will be made by the IF-THEN statement for each of the relation

symbols =, <, s

, <>, >=, and <=. The test output is in the second row of the

truth table.

12.2

IF-THEN Comparison of Zero with a Negative Number

The objective of this test is to show that the proper comparison of zero with a negative value will be made by the IF-THEN statement for each of the

relation symbols =, <, >, <>, >=, and <= . The test output is in the third

row of the truth table.

12.3

IF-THEN Comparison of a Negative Number with Zero

The objective of this test is to show that the proper comparison of a negative numerical value with zero will be made by the IF-THEN statement for

each of the relation symbols =, <, N

, <>, >=, and <= . The test output is in

the fourth row of the truth table.

12.4

IF-THEN Comparison of Positive with the Negation

of a Negative, Using Parentheses

The objective of this test is to show that the proper comparison of a positive numerical value with a numerical value that is enclosed in

parentheses will be made. The constant enclosed in the parentheses

represents the negative of a negative numerical value of equal magnitude to

the original positive value. The comparison will be made by the IF-THEN

statement for each of the relation symbols = , <, > , <

N

, > = , and <= . The

test output is in the fifth row of the truth table.

12.5

IF-THEN Comparison of Negative with a

76
Negation of a Positive, Using Parentheses

The objective of this test is to show that a proper comparison of a negative numerical value with a numerical value enclosed in parentheses will

be made. The value in parentheses represents the negative of a positive

numerical value of equal magnitude to the original negative value. The

comparison will be made by an IF-THEN statement for each of the relation

symbols =, <, >, <>, s =, and <= . The test output is in the sixth row in the

truth table.

*******************

* PROGRAM FILE 12 * *******************

10 PRINT "PROGRAM FILE 12"

60 PRINT

70 PRINT

80 PRINT

90 PRINT " BEGIN TEST."

100 PRINT

110 PRINT

120 LET A $ = " = " 130 LET B $ = " <

140 LET C$=">"

150 LET D$= " <

>

160 LET E$=" >=" 170 LET F $ = " < = " 180 LET A=1

190 LET B=2

200 LET C=3

210 LET L=-l

220 LET M=-2

230 LET N=-3

240 LET X=-2

250 LET Y=3

260 LET Z = 0 270 PRINT "ASSIGNED" ;TAB (20) ; "COMPARSION OF " ; TAB ( 5 4 )

; "TRUTH TABLE"

280 PRINT " VALUES " ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 )

; B $ ; TAB ( 5 4 ) ; C $ ; TAB ( 5 9 ) ; D$

;

290 PRINT TAB (65) ;E$;TAB (70) ;F$

300 PRINT

310 REM

320 REM SECTION 12.1: IF-THEN/NEG. VS. NEG.

330 REM

340 REM SECTION 12.1.1: EQUAL CASE.

350 IF M=X THEN 440

360 LET A $ = " X

370 GOTO 450

380 LET B $ = " X

77
390

400

410

420

430

440

450

460

470

480

490

500

510

520

530

540

550

560

570

580

590

600

610

620

630

640

650

660

670

680

690

700

710

720

730

740

750

760

770

780

790

800

810

820

830

840

850

860

870

880

890

900

910

920

930

940

950

GOTO 510

LET C$="X"

GOTO 530

LET D $ = " X

GOTO 600

LET A$= "T"

IF M>=X THEN 560

LET E $ = " X

GOTO 570

LET F$="T"

IF M<X THEN 380

LET B $ = " F

IF M>X THEN 400

LET C $ = " F

IF MOX THEN 420

LET D5="F"

GOTO 600

LET E $ = "T"

IF M<=X THEN 480

LET F $ = " F

GOTO 490

PRINT " B=2 " ;TAB (23) ; "M TO X” ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ) ;

B

PRINT C$;TAB (59) ;D$;TAB (65) ; E $ ; TAB (70) ;F$

REM

REM SECTION 12.1.2: NOT EQUAL CASE.

IF -3 <L THEN 730

LET B $ = " X

11 GOTO 740

LET A $ = " X

GOTO 800

LET C$="X"

GOTO 820

LET E $= " X

GOTO 890

LET B$="T"

IF -3<>L THEN 850

LET D$="X"

GOTO 860

LET F $ = " T

IF -3=L THEN 670

LET A$=" F" IF -3 >L THEN 690

LET C$=" F" IF -3 >=L THEN 710

LET E$="F"

GOTO 890

LET D $ = " T

IF -3<=L THEN 770

LET F $ = " X

GOTO 780

PRINT " L=-l " ;TAB (22);"-3 TO L" ; TAB ( 4 4 )

; A § ; TAB ( 4

9

)

;

l

PRINT C $

;

TAB (59) ;D$;TAB(65) ;E$;TAB(70) ;F$

REM

REM SECTION 12.2: IF-THEN/ZERO VS. NEG.

IF Z>X THEN 1020

LET C$="X"

GOTO 1030

$ ; TAB (54);

$ ; TAB (54)

;

78
960 LET A $ = " X

970 GOTO 1090

980 LET B $ = " X

990 GOTO 1110

1000 LET F $ = " X

1010 GOTO 1180

1020 LET C $ = " T"

1030 IF ZOX THEN 1140

1040 LET D$= " X

1050 GOTO 1150

1060 LET E$=" T"

1070 IF Z=X THEN 960

1080 LET A$="F"

1090 IF Z<X THEN 980

1100 LET B $ = " F

1110 IF Z<=X THEN 1000

1120 LET F $=" F"

1130 GOTO 1180

1140 LET D$=" T"

1150 IF Z>=X THEN 1060

1160 LET E $ = " X

1170 GOTO 1090

1180 PRINT " M=-2 " ; TAB (23) ; "Z TO X" ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ) ; B $ ; TAB ( 5 4

)

1190 PRINT C $ ; TAB (59) ; D $ ; TAB (65) ; E $ ; TAB (70) ; F

$

1200 REM

1210 REM SECTION 12.3: IF-THEN/NEG. VS. ZERO.

1220 IF MOZ THEN 1310

1230 LET D $ = " X

1240 GOTO 1320

1250 LET A $ = " X

1260 GOTO 1380

1270 LET C$="X"

1280 GOTO 1400

1290 LET E $ = " X

1300 GOTO 1470

1310 LET D$="T"

1320 IF M< Z THEN 1430

1330 LET B $ = " X

1340 GOTO 1440

1350 LET F $ = "T"

1360 IF M=Z THEN 1250

1370 LET A $ = " F

1380 IF M >Z THEN 1270

1390 LET C $ = " F

1400 IF M>=Z THEN 1290

1410 LET E $ = " F

1420 GOTO 1470

1430 LET B $= "T"

1440 IF M<=Z THEN 1350

1450 LET F$="X"

1460 GOTO 1360

1470 PRINT " N=-3 " ;TAB (23) ; "M TO Z " ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ) ; B $ ; TAB ( 5 4

)

1480 PRINT C $ ; TAB (59) ; D$ ; TAB (65) ; E $ ; TAB (70) ; F

$

1490 REM

1500 REM SECTION 12.4: IF-THEN/POS. VS. (NEG.OF NEG.).

1510 IF 3= (-N ) THEN 1600

1520 LET A $ = " X

79
1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

1980

1990

2000

2010

2020

2030

2040

2050

2060

2070

2080

2090

GOTO 1610

LET B$="X"

GOTO 1670

LET C$="X"

GOTO 1690

LET D$="X"

GOTO 1750

LET A$="T"

IF 3 >= (-N

)

LET E$="X"

GOTO 1730

LET F$="T"

IF 3<(-N) THEN

LET B $= " F"

IF 3>(-N) THEN

LET C $ = " F"

IF 3<>(-N)

LET D$="F"

GOTO 1750

LET E$="T"

IF 3<=(-N)

LET F$=" X"

PRINT " X=-2

PRINT

REM

REM

IF M= (-B)

LET A $ = " X

GOTO 1890

LET B $ = " X

GOTO 1950

LET C$="X"

GOTO 1970

LET D $ = " X

" GOTO 2040

LET A $ = " T

IF M>= (-B)

LET E$="X"

GOTO 2010

LET F $ = " T

IF M< (-B ) THEN

LET B $ = " F

IF M > (-B ) THEN

LET C $ = " F

IF MO (-B)

LET D$= " F"

GOTO 2040

LET E$="T"

THEN 1720

1540

1560

THEN 1580

THEN 1640

; TAB (23) ; " 3 TO ( -N ) " ; TAB ( 4 4 )

; A $ ; TAB ( 4 9 ) ; B $ ; TAB ( 5 4

)

C $ ;TAB (59) ;D$;TAB(65) ;E$;TAB(70) ;F$

SECTION 12.5: IF-THEN/NEG. VS. (NEG. OF POS .)

.

THEN 1880

THEN 2000

1820

1840

THEN 1860

IF M<= (-B) THEN 1920

LET F $ = " X

GOTO 1930

PRINT " Z =0 " ;TAB (23) ; "M TO ( -B ) " ; TAB ( 4 4 )

; A $ ; TAB ( 4 9 ) ; B $ ; TAB ( 5 4

)

PRINT C$;TAB (59) ;D$;TAB (65) ;E$;TAB (70) ;F$

PRINT

PRINT " IF NO X(S) APPEARED IN THE ABOVE TRUTH TABLE, THEN"

PRINT "THE SYSTEM PASSED THE TEST."

PRINT

I

80
2100 PRINT

2110 PRINT " END TEST."

2120 PRINT

2130 END

* SAMPLE OUTPUT * ***********

PROGRAM FILE 12

BEGIN TEST.

ASSIGNED COM PARS I ON OF TRUTH TABLE

VALUES = < > <> > = <

B = 2 M TO X T F F F T T

L=-l -3 TO L F T F T F T

M=-2 Z TO X F F T T T F N =-3 M TO Z F T F T F T

X=-2 3 TO (-N) T F F F T T

Z = 0 M TO (-B) T F F F T T

IF NO X(S) APPEARED IN THE ABOVE TRUTH TABLE' ! THEN

THE SYSTEM PASSED THE TEST.

END TEST.

81
13.0

IF-THEN COMPARISON OF NEGATIVE CONSTANTS (CONT)

AND VARIABLES AVOIDING PARENTHESES

Th i s statement

compar i ng

10 in BSR

section continues a case-by-case analysis of the IF-THEN control

that began in section 11. The emphasis in this section will be on assigned numeric variables. The user is referred to section 6 and

X3. 60. 13.1

IF-THEN Comparison of an Assigned Negative with a Negative Constant, Without Parentheses

The objective of this test is to show that the proper comparison of a negative numerical value assigned to a simple variable against another

negative value not assigned to a simple variable or enclosed in parentheses

will be made by the IF-THEN statement for each of the relation symbols = , <,

>, <>, >=, and <= . The test output falls in the first row of the truth

table output for PROGRAM FILE 13.

13.2

IF-THEN Comparison of a Negative Variable with a Negative Constant, Without Parentheses

The objective of this test is to show that the proper comparison of the

negative of a variable, assigned a positive numerical value, with a negative

value not assigned to a simple variable or enclosed in parentheses, will be

made by the IF-THEN statement for each of the relation symbols =, <, N

, <>,

>=, and <= . The test output falls in the second row of the truth table.

13.3

IF-THEN Comparison of Positive Variable with

Negative Variable, Without Parentheses

The objective of this test is to show that the proper

variable, assigned a positive value, with the negative of a

a value of the same magnitude as the positive value, will

IF-THEN statement for each of the relation symbols =, <, > The test output falls in the third row of the truth table.

comparison of a variable assigned

be made by the

<>, >=, and <= .

*******************

* PROGRAM FILE 13 * *******************

1 PRINT "PROGRAM FILE 13"

20 PRINT

30 PRINT

82
40 PRINT

60 LET A$="="

70 LET B$=" <

80 LET C$=">"

90 LET D $ = " < >

100 LET E $ = " > = " 110 LET F $ = " < = " 120 LET A=1

130 LET B=2

140 LET N=-3

150 LET X=-2

160 PRINT "ASSIGNED" ;TAB (20) ; "COMPARISON OF" ; TAB ( 5 4 ); "TRUTH TABLE"

170 PRINT " VALUES " ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ) ; B $ ; TAB ( 5 4 )

; C $ ;TAB ( 5 9 ) ; D$

;

180 PRINT TAB (65) ;E$;TAB (70) ;F$

190 PRINT

200 REM

210 REM SECTION 13.1: IF-THEN/ASSIGNED NEG. VS. NEG. CONSTANT, ABSENT

220 REM PARENTHESES.

230 IF N=-3 THEN 320

240 LET A $ = " X

250 GOTO 330

260 LET B $ = " X

270 GOTO 390

280 LET C$="X"

290 GOTO 410

300 LET D $ = " X

310 GOTO 480

320 LET A $ = " T

330 IF N > = — 3 THEN 440

34 0 LET E $ = " X

350 GOTO 450

360 LET F $ = " T

370 IF N <-3 THEN 260

380 LET B $ = " F

390 IF N>-3 THEN 280

400 LET C $ = " F

410 IF NO-3 THEN 300

420 LET D $ = " F

430 GOTO 480

4 40 LET E $ = " T

450 IF N < = -3 THEN 360

4 60 LET F $= " X

470 GOTO 370

480 PRINT " A=1 " ;TAB (23) ; "N TO -3 " ; TAB ( 4 4 ) ; A $ ; TAB ( 4 9 ); B $ ; TAB ( 5 4 )

;

4 90 PRINT C $ ; TAB (59) ; D$ ; TAB (65) ; E $ ; TAB

(

7 0 )

; F $

500 REM

510 REM SECTION 13.2: IF-THEN/NEG. VARIABLE VS. NEG. CONSTANT, ABSENT

520 REM PARENTHESES.

530 IF -A=— 1 THEN 620

540 LET A $ = " X

550 GOTO 630

560 LET B$="X"

570 GOTO 690

580 LET C$="X"

590 GOTO 710

600 LET D $= " X

610 GOTO 780

83
620

630

640

650

660

670

680

690

700

710

720

730

740

750

760

770

780

790

800

810

820

830

840

850

8 60

870

380

890

900

910

920

930

940

950

960

970

980

990

1000

1010

1020

1030

1040

1050

1060

10T0

1080

1090

1100

1110

1120

1130

1140

1150

1160

LET A$="T"

IF —A>=— 1 THEN 740

LET E $ = " X

GOTO 750

LET F$="T"

IF —A<— 1 THEN 560

LET B $ = " F" IF -A>— 1 THEN 580

LET C $ = " F

IF -AO-1 THEN 600

LET D$=" F" GOTO 780

LET E$="T"

IF -A<=-1 THEN 660

LET F$="X"

GOTO 670

PRINT " B=2 " ;TAB (22) ; "-A TO -1 " ;TAB (4 4 ) ; A$ ;TAB (49) ;B$

PRINT C$;TAB (59) ;D$;TAB (65) ;E$;TAB (70) ;F$

REM

REM SECTION 13.3: IF-THEN/POS. VARIABLE VS. NEG. VARIABLE

REM PARENTHESES.

IF B=-X THEN 920

LET A$="X"

GOTO 930

LET B$=" X"

GOTO 990

LET C$="X"

GOTO 1010

LET D$= " X

GOTO 1080

LET A$=" T"

IF B > = -X THEN 1040

LET E$=" X"

GOTO 1050

LET F $= "T"

IF B<-X THEN 860

LET B$="F"

IF B >—X THEN 880

LET C $ = " F

IF BO-X THEN 900

LET D$= " F" GOTO 1080

LET e$="T"

IF B<=-X THEN 960

LET F$="X"

GOTO 970

PRINT " N = - 3 ";TAB(23);"B TO -X " ; TAB (44) ; A $ ; TAB (49) ; B $

PRINT C $ ; TAB (59) ;D$;TAB (65) ; E $ ; TAB (70) ; F$

PRINT

PRINT " IF NO X(S) APPEARED IN THE ABOVE TRUTH TABLE

PRINT "THE SYSTEM PASSED THE TEST."

PRINT

PRINT " END TEST."

PRINT

END

8U

TAB (54)

ABSENT

TAB (54)

THEN"
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 13

ASSIGNED

VALUES

COMPARISON OF

= < TRUTH

N TABLE

<> > = <

A = 1 N TO -3 T F F F T T

B = 2 -A TO -1 T F F F T T

N=-3 B TO -X T F F F T T

IF NO X(S) APPEARED IN THE ABOVE TRUTH TABLE, THEN

THE SYSTEM PASSED THE TEST.

END TEST.

85
14.0

COMPARING QUOTED STRINGS AND STRING VARIABLES

The program for this test prints four columns. The first column prints

the names of certain string variables used in the program. The second column

lists the strings assigned to these variables, within the program, to the

string variables in the first column. The third column lists the comparisons

made and whether they are between string constants or assigned string

variables. The last column prints the truth table for this test program.

The user need only look for X's printed in the table. If there are none the

system has passed the test.

The standard states that string comparisons can only be made for

equal ity

X3. 60 )

. BASIC.

( = ) and inequality ( <> ) (see section 10.2 and 10.4 of BSR

Tests of collating sequences are inapplicable for Minimal

14.1

Comparing Identical Strings

The objective of this test is to show that a comparison of two strings

having the same sequential order of characters will be made by the IF-THEN

statement. This test generates the values in the first row as the column

four truth table output in the sample output for this section.

14.2

Strings of Equal Length but Different Characters

The objective of this test is to show that a comparison of two different

strings having the same number of characters will be made by the IF-THEN

statement. This test outputs the values in the second row of the truth

table

.

14.3

Strings of the Same Length which have the Same Characters

but not in the Same Sequential Order

The objective of this test is to show that a comparison of two strings,

having the same character set, but not in the same sequential order, will be

made by the IF-THEN statement. The output for this test lies in the third

row of the truth table.

14.4

Leading Spaces

The objective of this test is to show that a proper comparison of two

strings having the same non-space characters in the same sequential order,

but with leading spaces for one of the strings, will be performed. The

output for this test lies in the fourth row of the truth table. According to

the standard these strings are not equal since spaces within quoted strings

are considered significant.

14.5

Trailing Spaces

86
The objective of this test is to show that a proper comparison of two

strings having the same non-space characters in the same sequential order,

but with trailing spaces used in one of the strings, will also be performed.

The output for this test lies in the fifth row of the truth table. Again,

these two quoted strings are not equal.

14.6 Leading and Trailing Spaces

The objective of this test is to show the effect of using both leading

and trailing spaces in the comparison of two strings. The strings in this

test appear the same except for the leading and trailing spaces in one of

them. The result should be that the two strings are not equal since spaces

in strings are significant. The output for this test lies in the sixth row

of the truth table.

14.7 A Variety of Unequal String

The objective of this test is to further verify that the relation of

equality holds between two strings if and only if the two strings have the same length and contain identical sequences of characters. This test

compares various strings of different characters as well as of different

lengths. The output for this test lies in the seventh through ninth rows of

the truth table.

*******************

* PROGRAM FILE 14 * *******************

10 PRINT "PROGRAM FILE 14"

60 PRINT

70 PRINT

80 PRINT

90 LET D

$= " = " 100 LET G$="<>"

110 LET A $ = " Z ON E

120 LET B$="NESTING"

130 LET C$=" IMPLEMENTATION"

140 LET L$="NEST"

150 LET M$="KEYWORD"

160 LET N$=" MARGIN"

170 LET Y$="LINE"

180 PRINT

190 PRINT " IN THE COMPARISON COLUMN BELOW, THE UNDERLINE CHARAC-"

200 PRINT "TER IS USED TO REPRESENT THE SPACE CHARACTER."

210 PRINT

220 PRINT

230 PRINT " STRING " ; TAB ( 23 ) ; " ASS IGNED" ; TAB ( 4 4 )

; "COMPARS ION" ; TAB ( 6 4 )

;

87
240

250

260

270

280

290

300

310

320

330

340

350

360

370

380

390

400

410

420

430

440

450

460

470

480

490

500

510

520

530

540

550

560

570

580

590

600

610

620

630

640

650

660

670

680

690

700

710

720

730

740

750

760

770

780

790

800

PRINT "TRUTH"

PRINT "VARIABLES" ;TAB (22) ; "CHARACTERS" ;TAB (48) ; "OF" ; TAB (64) ; "TABLE"

PRINT TAB (64) ;D$;TAB (67) ;G$

PRINT

REM

REM SECTION 14.1: STRINGS OF EQUAL LENGTH WITH THE SAME SEQUENTIAL

REM CHARACTERS VS. EACH OTHER.

IF "MAY"="MAY" THEN 360

LET D$="X"

GOTO 370

LET G$="X"

GOTO 390

LET D$="T"

IF "MAY" <>"MAY" THEN 340

LET G$= " F"

PRINT " A$ " ;TAB (25) ; "ZONE" ;TAB (44) ; "MAY TO MAY " ; TAB ( 6 4 ) ; D$

;

PRINT TAB (68) ;G$

REM

REM SECTION 14.2: STRINGS OF EQUAL LENGTH BUT DIFFERENT CHARACTERS.

IF A$ <>Y$ THEN 480

LET G$="X"

GOTO 490

LET D$="X"

GOTO 510

LET G$="T"

IF A$=Y$ THEN 460

LET D$=" F" PRINT " B$ " ;TAB (23) ; "NESTING" ;TAB (45) ; "A§ TO Y$ " ; TAB ( 6 4 ) ; D$

;

PRINT TAB (68) ;G$

REM

REM SECTION 14.3: STRINGS OF THE SAME LENGTH WHICH HAVE THE SAME

REM CHARACTERS BUT NOT SEQUENTIALLY ORDERED THE SAME.

IF "MAY"="YAM" THEN 610

LET D$=" F" GOTO 620

LET G$= "T"

GOTO 640

LET D $ = " X

IF " MAY" < >

" YAM " THEN 590

LET G$="X"

PRINT " C$ " ;TAB (20) ; "IMPLEMENTATION" ;TAB (44) ; "MAY TO YAM";

PRINT TAB ( 64 )

; D$ ; TAB (68) ; G$

REM

REM SECTION 14.4: TESTING THE SIGNIFICANCE OF LEADING SPACES IN

REM STRING COMPARISONS.

IF "MAY" <>" MAY" THEN 740

LET G$="X"

GOTO 750

D$="X"

GOTO 770

LET G$="T"

IF " MAY"= " MAY" THEN 720

D $ = " F

" PRINT " L$ " ;TAB (25) ; "NEST" ;TAB (44) ; "MAY TO MAY" ; TAB ( 6 4 )

;

PRINT D$ ; TAB ( 68 ) ;G$

REM

REM SECTION 14.5: TESTING THE SIGNIFICANCE OF TRAILING SPACES IN

88
810 REM STRING COMPARISONS.

820 IF "MAY"="MAY " THEN 850

830 LET D$=“F"

840 GOTO 860

850 LET D$=" X"

860 IF m MAY"<>"MAY h THEN 890

870 LET G$= H X"

880 GOTO 900

890 LET G$="T"

900 PRINT " M$ " ;TAB (23) ; "KEYWORD" ;TAB (44) ; "MAY TO MAY "; 910 PRINT TAB (64) ;D$;TAB(68) ;G$

920 REM

930 REM SECTION 14.6: TESTING LEADING AND TRAILING SPACES TOGETHER IN

940 REM STRING COMPARISONS.

950 IF " MA Y " <

>

" MAY " THEN 1000

960 LET G$="X"

970 GOTO 1010

980 LET D$="X"

990 GOTO 1030

1000 LET G $ = " T

1010 IF " MA

Y " = " MAY " THEN 980

1020 LET D$= " F"

1030 PRINT " N §

" ;TAB (24) ; "MARGIN" ;TAB (44) ; "MAY TO MAY

1040 PRINT TAB (64) ;D$;TAB (68) ;G$

1050 REM

1060 REM SECTION 14.7: TESTING A VARIETY OF UNEQUAL STRINGS OF LENGTH

1070 REM AND CHARACTERS FOR COMPARISONS.

1080 IF C$=B$ THEN 1210

1090 LET D $ = " F

1100 GOTO 1220

1110 LET G $ = " T

1120 IF C $ ON $ THEN 1250

1130 LET E$="X"

1140 GOTO 1260

1150 LET F $ = " X

1160 GOTO 1280

1170 LET H $ = " T

1180 IF "KEY"=M$ THEN 1310

1190 LET I $= " F"

1200 GOTO 1320

1210 LET D $ = " X

1220 IF L$OB$ THEN 1110

1230 LET G $ = " X

1240 GOTO 1120

1250 LET E $ = " T

1260 ] ? C $=N $ THEN 1150

1270 LET F $ = " F

1280 IF "KEY" <>M$ THEN 1170

1290 LET H § = " X

1300 GOTO 1180

1310 LET I$="X"

1320 PRINT " Y $

" ;TAB (25) ; "LINE" ;TAB (45) ; "L$ TO B$ " ; TAB ( 6 4 ) ; D$

;

1330 PRINT TAB (68) ;G$

1340 PRINT TAB (45) ; "C$ TO N

$

" ; TAB ( 6 4 ) ; D$ ; TAB ( 6 8 )

; G$

1350 PRINT TAB (44) ; " KEY TO M$ " ; TAB ( 6 4 ) ; D$ ; TAB ( 6 8 )

; G$

1360 PRINT

1370 PRINT " IF NO X(S) APPEARED IN THE ABOVE TRUTH TABLE, THEN"

89
1380 PRINT "THE SYSTEM PASSED THE TEST."

1390 PRINT

1400 PRINT " END TEST."

1410 PRINT

1420 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 14

IN THE COMPARISON COLUMN BELOW, THE UNDERLINE CHARACTER IS USE TO REPRESENT THE SPACE CHARACTER.

STRING ASSIGNED COM PARS ION TRUTH

VARIABLES CHARACTERS OF TABLE

= <>

A$ ZONE MAY TO MAY T F B$ NESTING A$ TO Y$ F T

c$ IMPLEMENTATION MAY TO YAM F T

L$ NEST MAY TO MAY F T

M$ KEYWORD MAY TO MAY F T

N $ MARGIN MAY TO MAY F T

Y$ LINE L$ TO bT — F T

c$ TO N $ F T

KEY TO M $ F T

IF NO X(S) APPEARED IN THE ABOVE TRUTH TABLE, THEN

THE SYSTEM PASSED THE TEST.

END TEST.

90
15.0 TEST OF IF-THEN TRANSFER TO ILLEGAL LINE NUMBER

The objective of this test is to verify that the execution of an IF-THEN

statement, referring to a non-existent, line will cause program execution to

be suspended by the system. To continue the program, execution should

require some user-directed restart procedures which would be

implementation-dependent. In the output for this test there should be an implementation specific diagnostic for an error.

*******************

* PROGRAM FILE 15 * *******************

10

60

70

80

90

100

110

120

130

140

150

160

170

180

190

200

210

220

230

240

250

260

270

280

290

PRINT "PROGRAM FILE 15"

PRINT

PRINT

PRINT

PRINT " SECTION 15.0: FATAL ERROR CHECK ON IF-THEN STATEMENT."

PRINT

PRINT

PRINT

PRINT " THE OBJECTIVE OF THIS SECTION IS TO USE AN IF-THEN"

PRINT "STATEMENT WHICH REFERS TO A NON-EXISTENT LINE-NUMBER. IF"

PRINT "THE SYSTEM RECOGNIZES THIS AS A FATAL ERROR (THAT IS, SUSPRINT "PENDING PROGRAM EXECTION SUCH THAT USER-DIRECTED RESTART"

PRINT "PROCEDURES ARE REQUIRED), THEN THE TEST WILL HAVE PASSED."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET A=5

IF A<>5 THEN 99

PRINT "TEST FAILED."

PRINT

PRINT " END TEST.

PRINT

END

n

*****************

* SAMPLE OUTPUT * *****************

91
7UNDEFINED LINE NUMBER 99 IN LINE 240

92
16.0 LINE LABELS WITH AND WITHOUT LEADING ZEROES

This unit tests the unique line-number which serves as a label for the

statement on the line. The labels at the beginning of each line have the

following restrictions: (1) they do not contain and are not preceded by

spaces, and (2) they are within the range 1 to 9999 inclusive. Leading

zeroes have ho effect (see section 4 of BSR X3.60). These tests are performed with GOTO, IF-THEN, and PRINT statements only. The GOTO Statement

uses line numbers which may or may not have leading zeroes and these same line numbers when used as line labels may have fewer leading zeroes than in

the GOTO statements. The output for this test is in the form of messages to

the user that describe the sequence of label tests as they proceed and

whether each has passed or failed. A final "passed" or "failed" message is

given at the end.

*******************

* PROGRAM FILE 16 * *******************

1 PRINT "PROGRAM FILE 16'

16 PRINT

19 PRINT

22 PRINT

25 PRINT " 28 PRINT

31 PRINT " 34 PRINT

37 LET M=1

40 PRINT " 43 GOTO 058

0046 PRINT “ 49 LET Z=N

52 PRINT " 55 GOTO 0070

58 PRINT " 61 LET N=M

64 PRINT " 67 GOTO 46

070 PRINT " 73 IF Z=1 THEN 82

76 PRINT " 79 GOTO 91

82 PRINT " 85 PRINT

88 PRINT " 91 PRINT

9999 END

SECTION 16.0: LINE LABELS, WITH/WITHOUT LEADING ZEROES."

BEGIN TEST."

TEST 1, GOTO USING 1 LEADING ZEROES ON LABEL."

TEST 2 PASSED, LABEL GAINED 2 LEADING ZEROES."

TEST 3, GOTO USING 2 LEADING ZEROES ON LABEL."

TEST 1 PASSED, LABEL LOST ALL OF ITS LEADING ZEROES."

TEST 2, GOTO USING NO LEADING ZEROES ON LABEL."

TEST 3 PASSED, LABEL LOST 1 OF ITS LEADING ZEROES."

LEADING ZEROES TEST FAILED."

LEADING ZEROES TEST PASSED."

END TEST.

93
*****************

PROGRAM FILE

SECTION

TEST

TEST 1 TEST

TEST

TEST

TEST

* SAMPLE OUTPUT * *****************

16

16.0: LINE LABELS, WITH/WITHOUT LEADING ZEROES.

BEGIN TEST.

1, GOTO USING 1 LEADING ZEROES ON LABEL.

PASSED, LABEL LOST ALL OF ITS LEADING ZEROES.

2, GOTO USING NO LEADING ZEROES ON LABEL.

2 PASSED, LABEL GAINED 2 LEADING ZEROES.

3, GOTO USING 2 LEADING ZEROES ON LABEL.

3 PASSED, LABEL LOST 1 OF ITS LEADING ZEROES.

LEADING ZEROES TEST PASSED.

END TEST.

9h
17.0 ORDER OF LINES - TWO LINES WITH THE

SAME LINE NUMBER

The objective of the next two tests is to determine whether the ordering

of line numbers and/or using duplicate line numbers will be recognized by

implementations as an error or be adjusted by a local editing facility. In

the present test the implementation is asked to accept a program with a duplicate line at 260. There are two possible cases here. First, if the

system does not have a program editor, then a diagnostic should be given.

If, however, the system does automatically edit programs, then an output to

the test program should be given without also giving an error diagnostic.

*******************

* PROGRAM FILE 17 * *******************

10 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

230 PRINT

240 PRINT

260 LET Y=

260 LET Y=

270 PRINT

280 PRINT

290 PRINT

300 PRINT

310 PRINT

320 PRINT

330 PRINT

340 PRINT

350 PRINT

360 END

PROGRAM FILE 17"

SECTION 17.0: TEST OF LINES WITH SAME NUMBER."

" NOTE: LOCAL EDITING FACILITIES MAY ALLOW"

"FOR THE ENTRY OF STATEMENT LINES IN ANY ORDER AND ALSO"

"ALLOW FOR DUPLICATE LINE-NUMBERS AND LINES CONTAINING"

"ONLY A LINE-NUMBER. THIS TEST MAY PRODUCE AN"

"ERROR DIAGNOSTIC ON OTHER SYSTEMS."

" BEGIN TEST."

1111

9999

" Y=" ;

Y

" SINCE A VALUE FOR Y HAS BEEN PRINTED IT CAN BE AS-"

"SUMED THAT THIS SYSTEM DOES NOT RECOGNIZE DUPLICATE LINE-"

"NUMBERS AS AN ERROR. IF Y= 9999 THEN THE LAST LINE"

"260 WAS RETAINED BY THE LOCAL EDITOR."

END TEST."

95
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 17

SECTION 17.0: TEST OF LINES WITH SAME NUMBER

NOTE: LOCAL EDITING FACILITIES MAY ALLOW

FOR THE ENTRY OF STATEMENT LINES IN ANY ORDER AND ALSO

ALLOW FOR DUPLICATE LINE-NUMBERS AND LINES CONTAINING

ONLY A LINE-NUMBER. THIS TEST MAY PRODUCE AN

ERROR DIAGNOSTIC ON OTHER SYSTEMS.

BEGIN TEST.

Y= 9999

SINCE A VALUE FOR Y HAS BEEN PRINTED IT CAN BE ASSUMED THAT THIS SYSTEM DOES NOT RECOGNIZE DUPLICATE LINENUMBERS AS AN ERROR. IF Y= 9999 THEN THE LAST LINE

260 WAS RETAINED BY THE LOCAL EDITOR.

END TEST.

96
18.0 ORDER OF LINES LINES OUT OF ORDER

This test verifies whether the test system will either recognize lines

out of order as an error when no local editor is available or have a program

editor that reorders the lines (see section 4.6 in BSR X3.60). On

output, there should be a diagnostic for systems without editors or two

numbers in order Al= 1111 and A2= 9999. If these numbers are produced in

reverse order then the local editor did not reorder the lines. The test

language processor executed one line after the other without regard to line

order

.

*******************

* PROGRAM FILE 18 * *******************

10 PRINT "PROGRAM FILE 18"

60 PRINT

70 PRINT

80 PRINT

90 PRINT " SECTION 18.0: LINES OUT OF ORDER."

100 PRINT

110 PRINT

120 PRINT M BEGIN TEST."

130 PRINT

150 LET A = 9999

145 PRINT " Al = " ; A

140 LET A =am

160 PRINT "A2 = " ;A 170 PRINT

180 PRINT "TWO NUMBERS SHOULD HAVE BEEN PRINTED AS:"

190 PRINT " Al = 1111"

200 PRINT "A2 = 9999"

210 PRINT "IF 'THIS OUTPUT WAS REVERSED THEN SYSTEM DID"

220 PRINT "NOT RECOGNIZE LINES OUT OF ORDER."

230 PRINT

240 PRINT II END TEST."

250 PRINT

260 END

*****************

* SAMPLE OUTPUT * *****************

97
PROGRAM FILE 18

SECTION 18.0: LINES OUT OF ORDER.

BEGIN TEST.

Al = 1111

A2= 9999

TWO NUMBERS SHOULD HAVE BEEN PRINTED AS:

Al= 1111

A2= 9999

IF THIS OUTPUT WAS REVERSED THEN SYSTEM DID

NOT RECOGNIZE LINES OUT OF ORDER.

END TEST.

98
19 0 THE ABS FUNCTION AND ELEMENTARY NUMERICAL EXPRESSIONS

USING CONSTANTS

The objective of the next several test sections is to verify that

numeric expressions can be constructed from simple variables and constants

using the operations of addition, subtraction, multiplication, division, and

involution. They further verify that simple variables and constants can be

used as arguments for an absolute value function reference. One item the user should be wary of in these tests is that a difference in format of

output does not force a test failure. For example, there are numbers that

should be printed in NR2 format that some non-conforming systems might print

in NR3. The non-conformance would only be in formatting of numbers which

would have been tested previously. The user need only check the test output

for asterisks after the last ouput column, where numerical errors are printed. At the lowest level, the tests are passed if there are no diagnostics for the ABS function or for the expressions. That is, the host

system can evaluate them. However, in order to pass the test entirely, there

should be no asterisks. If there are, this means that some operation has

generated a result that is out of tolerance. The user should be familiar at

this point with sections 7 and 8 of BSR X3.60.

These tests further extend the capability of

since there is a comparison of the ABS function

constant. The successful evaluation of this form of

demonstrates that an intrinsic function can be

condition.

the IF-THEN statement,

of an argument against a the IF-THEN Statement

referenced in the branch

19.1 The ABS Function

The objective of this

absolute value function,

numerical expressions. The

these terms will consist of

test section is to introduce a reference to

The arguments used will be the simplest of

expressions will consist of only one term

only one factor

.

the

the

and

Even if two results agree to within six digits, the actual machine

representation of the test system may use a register or memory storage

location that holds more bits than required for a six digit representation.

The errors printed only represent differences between computed results and

converted program constants. The only errors flagged are those that differ

by a unit or more in the sixth significant digit of the result. Absolute

error means the absolute value of the difference between the test system

computed result and the comparison result, which is the true result rounded

to six significant digits.

19.1.1 Using Numerical Constants for Arguments

The objective of this test is to verify that numerical constants can be

used as arguments in an absolute value function. This test uses both

negative and positive numerical constants as the arguments in an absolute

value function reference. That is, both negative and positive NRl , NR2 , and

NR3 constants are used for the arguments. The output format is in three

columns. The first column is labeled "ARGUMENT" and represents the constant

used as the argument. The second column is labeled "TRUE EVALUATION", and

the third column is labeled "SYSTEM EVALUATION". In the second column we

99
list the standard conforming output expected and in the third column we list

the evaluations of the absolute value function on the system being tested.

An asterisk should appear beside any evaluation that does not conform to the

standard

.

19.1.2

Using Assigned Variables for Arguments

The objective of this test is to verify that simple variables can be

used as the arguments for an absolute value function. This test uses both

negative and positive numbers assigned to the simple variables.

Specifically, both negative and positive NR1 , NR2 , and NR3 constants have

been assigned to the simple variables, and these simple variables are then

used as arguments in absolute value function referencing. The test uses the same output format as in test 19.1.1.

19.2

Primitive Operations

The remainder of this section and the next two sections are devoted to

verifying that numerical expressions can be constructed from two terms

(involving addition or subtraction), two factors (involving multiplication or division), or from a base and an exponent (involving involution), using

constants only.

19.3

Using Numerical Constants in Addition

This test initiates the construction of numerical expressions from

numerical constants. This test and the next two proceed through each of the

operations of addition, subtraction, multiplication, division, and

involution. Each test is structured to use the same type of constants for

each operation, that is, NRl constants are not used with NR2 constants, NR2

constants are not used with NR3 constants, etc.

The objective of this test subsection is to verify that the operation of

addition between two numerical constants will yield at least six decimal

digits of precision. This routine tests the addition of two NRl constants,

two NR2 constants and two NR3 constants. The output of this test falls into

four columns of which the first column is labeled "1st. ADDEND PLUS 2nd.

ADDEND", the second column is labeled "REQUIRED SUM", the third column is

labeled "SUM OF SYSTEM", and the fourth column is labeled "ABSOLUTE ERROR".

The first column lists the pairs of numerical constants that are added; the

second column lists the standard conforming expected output; the third

column lists the sums of the constants as evaluated by the system being

tested; and the fourth column lists the absolute difference between the

expected values and the system generated values. If the implementation did

not maintain at least six decimal digits of precision, an asterisk will

appear to the right of the fourth column.

*******************

* PROGRAM FILE 19 * *******************

100
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

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

PRINT "PROGRAM FILE 19”

PRINT

PRINT

PRINT

PRINT " SECTION 19.1: THE ABS FUNCTION."

PRINT

PRINT

PRINT " SECTION 19.1.1"

PRINT

PRINT " (USING NUMERICAL CONSTANTS FOR ARGUMENTS.)"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET A=ABS (-10)

IF AO10 THEN 230

LET A$=" " GOTO 240

LET A $ = " * " LET B=ABS (15)

IF B<>15 THEN 280

LET B$=" " GOTO 290

LET B $ = " *

LET Al=ABS (-.5)

IF Al<>. 5 THEN 330

LET C$ = " " GOTO 340

LET C$=" *

LET B 1=ABS ( .125)

IF BIO. 125 THEN 380

LET D$= " " GOTO 390

LET D $ = " * " LET A2=ABS (-62. 5E-3)

IF A2062.5E-3 THEN 430

GOTO 440

GOTO 440

LET E $= " *

LET B2=ABS (312. 5E-4)

IF B20312.5E-4 THEN 480

LET F$=" " GOTO 490

LET F $ = " *

PRINT

PRINT " EACH EVALUATED FAILURE OF THE ABS FUNCTION WILL BE DE-"

PRINT ."NOTED BY AN ASTERISK BEING PRINTED ON THAT COMPARATIVE ROW"

PRINT "OF OUTPUT. TEST PASSED IF THERE ARE NOT ANY ASTER-"

PRINT "ISKS."

PRINT

PRINT

PRINT " TRUE SYSTEM " PRINT

PRINT

"ARGUMENT n ii § EVALUATION" , "EVALUATION"

PRINT " - 1

0

10 " ,A;A$

PRINT " 15 "," 15 "

, B ; B $

PRINT "-.5 "

. 5 ",Al;C$

101
.

-
1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1350

1360

1370

1380

1390

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

PRINT

PRINT "VALUE OF"," TRUE " , " SYSTEM " PRINT "ARGUMENT" , "EVALUATION" , "EVALUATION"

PRINT

PRINT "-10 "," 10 " , M 1 ; A $

" 15 15 " , M 2 ; B

$

"-.5 "," .5 " , M3 ;C

$

" .125 "," .125 " , M 4 ; D $

"-62.5E-3 "," .0625 ",M5;E$

" 312.5E-4 "," .03125 ",M6;F$

END TEST.

SECTION 19.2.1"

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT " AN OPERATION TEST FAILURE MEANS A FAILURE TO MAINTAIN"

PRINT "AT LEAST 6 DIGITS OF PRECISION."

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "1ST. ADDEND"

PRINT " PLUS ", "REQUIRED" , "SUM OF" , "ABSOLUTE"

PRINT "2ND. ADDEND"," SUM "," SYSTEM"," ERROR " PRINT

PRINT

LET L2=2+144

LET L3=(2+144)+(-146)

IF ABS ( L 3 ) < = lE-3 THEN 1760

PRINT "2

PRINT " + ="," 146 ",L2,L3;"*"

PRINT "144

GOTO 1790

PRINT " 2 PRINT " + PRINT " 144

BEGIN TEST."

+ ADDITION +"

146 " , L 2 , L

3

103
1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

1980

1990

2000

2010

2020

2030

2040

2050

2060

2070

2080

2090

2100

2110

2120

2130

2140

2150

2160

2170

2180

2190

PRINT

PRINT

LET 03=15.25+5.50

LET O4=(15.25+5.50)+(-20.75)

IF ABS (04) <=lE-4 THEN 1880

PRINT " 15.25

20.75 ”,03,04;"*“

20.75 ",03,04

PRINT " + PRINT " 5.50

GOTO 1910

PRINT " 15.25

PRINT " + PRINT " 5.50

PRINT

PRINT

LET Pl=2. 55E20+3. 6E21

LET P2= (2. 55E20+3. 6E21) + (-3. 8 55E21)

IF ABS ( P 2 ) < = 1E16 THEN 2000

PRINT " 2.55E20 " PRINT " + PRINT " 3.6E21 " GOTO 2030

PRINT " 2.55E20 " PRINT " + PRINT " 3.6E21 " PRINT

PRINT

LET Wl=44E-20+55E-19

LET W2= (44E-20+55E-19) + (-59. 4E-19)

IF ABS (W2) <=lE-23 THEM 2120

PRINT " 44E-20

3 . 85500E21 " ,P1,P2; "*'

3 . 85500E 21 ",P1,P2

PRINT " + PRINT " 55E-19

GOTO 2160

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

END

44E-20

+ 55E-19

5. 9400 0E-18 " ,Wl,W2; "

1

5 . 94000E-18 " , W 1 , W

2

END TEST.

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 19
SECTION 19.1s THE ABS FUNCTION

SECTION 19.1.1

(USING NUMERICAL CONSTANTS FOR ARGUMENTS.)

BEGIN TEST.

EACH EVALUATED FAILURE OF THE ABS FUNCTION WILL BE DENOTED BY AN ASTERISK BEING PRINTED ON THAT COMPARATIVE ROW

OF OUTPUT. TEST PASSED IF THERE ARE NOT ANY ASTERISKS.

ARGUMENT

-10

15

-.5

. 125

-62. 5E-3

312. 5E-4

TRUE

EVALUATION

10

15

. 5

. 125

. 0625

.03125

SYSTEM

EVALUATION

10

15

. 5

. 125

. 0625

. 03125

END TEST.

SECTION 19.1.2

(USING ASSIGNED VARIABLES FOR ARGUMENTS.)

BEGIN TEST.

EACH EVALUATED FAILURE OF THE ABS FUNCTION WILL BE DENOTED BY AN ASTERISK BEING PRINTED ON THAT COMPARATIVE ROW

OF OUTPUT. CHECK TEST PASSED IF THERE ARE NOT ANY ASTERISKS.

VALUE OF

ARGUMENT

-10

15

-.5

. 125

-62. 5E-3

312. 5E-4

TRUE

EVALUATION

10

15

. 5

. 125

. 0625

. 03125

SYSTEM

EVALUATION

10

15

. 5

. 125

. 0625

. 03125

END TEST.

\ 105
SECTION 19.2.1

AN OPERATION TEST FAILURE MEANS A FAILURE TO MAINTAIN

AT LEAST 6 DIGITS OF PRECISION.

BEGIN TEST.

+ ADDITION +

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

1ST. ADDEND

PLUS

2ND. ADDEND

REQUIRED

SUM

SUM OF

SYSTEM

ABSOLUTE

ERROR

2+ = 144

146 146 0

15.25

+ = 5.50

20.75 20.75 0

2. 55E20

+ =

3. 6E21

3. 85500E21 3. 85500E+21 0

44E-20

+ = 55E-19

5. 94000E-18 5. 94000E-18 0

END TEST.

106
20.0

ELEMENTARY NUMERICAL EXPRESSIONS USING CONSTANTS (CONTINUED)

20.1

Subtraction

The objective of this test is to verify that the operation of

subtraction of numerical constants will maintain at least six decimal digits

of precision. The test forms the difference each of two NR1 constants, two

NR2 constants, and two NR3 constants. There is again a four column output of

which the first column is labeled "MINUEND MINUS SUBTRAHEND", the second

column is labeled "REQUIRED DIFFERENCE", the third column is labeled

"DIFFERENCE OF SYSTEM", and the fourth column is labeled "ABSOLUTE ERROR".

The first column contains the pairs of numerical constants that are subtracted; the second column lists the standard conforming expected output;

the third column lists the differences of the constants as evaluated by the

system being tested; and the fourth column contains the absolute errors

generated in the evaluation. If the implementation did not maintain at least

six decimal digits of precision, an asterisk will appear beside any such case

to the right of the fourth column.

20.2

Multiplication

The objective of this test is to verify that the operation of

multiplication of two numerical constants will maintain six significant

digits of precision. The test multiplies each of two NRl constants, two NR2

constants, and two NR3 constants. The test outputs four columns of which the

first column is labeled "1st FACTOR TIMES 2nd. FACTOR", the second column is

labeled "REQUIRED PRODUCT", the third column is labeled "PRODUCT OF SYSTEM",

and the fourth column is labeled "ABSOLUTE ERROR". The first column lists

the pairs of numerical constants that are multiplied; the second column

lists the standard conforming output; the third column lists the products of

the constants as evaluated by the system being tested; and the fourth column

contains the absolute errors. Again an asterisk will appear to the right

the fourth

cr iter ia.

of

column for the products not satisfying the six significant digit

* PROGRAM FILE 20 *

0010 PRINT "PROGRAM FILE 20"

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT " BEGIN TEST."

0100 PRINT

0110 PRINT

107
0120

0130

0140

0150

0160

0170

0160

0190

0200

0210

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

PRINT H SECTION 20.1"

PRINT

PRI NT " " PRINT " - SUBTRACTION - M PRI NT " " PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT " MINUEND ", "DIFFERENCE"

PRINT " MINUS "," REQUIRED "," OF ", "ABSOLUTE"

PRINT "SUBTRAHEND" , "DIFFERENCE" , " SYSTEM ERROR " PRINT

PRINT

LET P4 = 9 56-4 82

LET P5=(956-482)-474

IF ABS ( P 5 ) < = lE-3 THEN 370

PRINT " 956

PRINT " - ="," 474 ",P4,P5;"*"

PRINT "482

GOTO 400

PRINT " 956

PRINT " - ="," 474 " , P 4 , P

5

PRINT " 482

PRINT

PRINT

LET P6=356. 41-574. 32

LET P7=(356. 41-574. 32) - (-217. 91)

IF ABS ( P 7 ) <=lE-3 THEN 490

PRINT " 356.41

PRINT " - =","-217.91 " , P 6 , P 7

; " *

PRINT " 574.32

GOTO 520

PRINT " 356.41

PRINT " - =","-217.91 " , P 6 , P

7

PRINT " 574.32

PRINT

PRINT

LET P8=15. 7E-24-18. 5E-23

LET P9= (15. 7E-24-18. 5E-23) - (-16. 93E-23)

IF ABS (P9) <=lE-27 THEN 610

PRINT " 15.7E-24 " PRINT " - =" , "-1. 69300E-22 ",P8,P9;“*"

PRINT " 18.5E-23 " GOTO 640

PRINT " 15.7E-24 " PRINT " PRINT " 18.5E-23 " PRINT

PRINT

LET Q1=17E20-14E19

LET Q2=(17E20-14E19)-15.6E20

IF ABS ( Q 2 ) < = 1E 16 THEN 730

-1. 69300E-22 " , P 8 , P

9

108
0690 PRINT M 17E20 II 0700 PRINT If — II ," 1 . 56000E21 “,Ql,Q2;"* n 0710 PRINT " 14E19 II 0720 GOTO 760

0730 PRINT " 17E20 r« 0740 PRINT ft _ ii 1. 56000E21 "

, Q 1 , Q 2 0750 PRINT " 14E19 ii 0760 PRINT

0770 PRINT It END TEST.

0780 PRINT

0790 PRINT

0800 PRINT

0810 PRINT n BEGIN TEST.

0820 PRINT

0830 PRINT

0840 PRINT •• SECTION 20.2"

0850 PRINT

0860 PRINT ii XXXXXXXXXXXXXXXXXX"

0870 PRINT ti X MULTIPLICATION X"

0880 PRINT ii XXXXXXXXXXXXXXXXXX"

0890 PRINT

0900 PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE

0910 PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

0920 PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE0930 PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-!

0940 PRINT "SIX PLACE ACCURACY."

0950 PRINT

0960 PRINT

0970 PRINT "1ST. FACTOR"

0980 PRINT " TIMES M

, "REQUIRED" , "PRODUCT OF", "ABSOLUTE"

0990 PRINT "2ND. FACTOR" /'PRODUCT "," SYSTEM ", " ERROR " 1000 PRINT

1010 PRINT

1020 LET Q3=95*15

1030 LET Z 2 =(95*15)- 1425

1040 IF ABS ( Z 2 ) < = 1E- 2 THEN 1090

1050 PRINT " 9 5

n 1060 PRINT •• * — 11 w

9 1425 ",Q3,Z2;"*"

1070 PRINT " 15 ii 1080 GOTO 1120

1090 PRINT " 95 n 1100 PRINT " * _ ii n

9 1425 "

, Q3 , Z 2 1110 PRINT " 15 II 1120 PRINT

1130 PRINT

1140 LET Q4 =96.2*10. 3 1150 LET 05 =(96.2*10 .3)- 990.86

1160 IF ABS (05 ) <=1E- 3 THEN 1210

1170 PRINT " 96.2 It 1180 PRINT » * — ft VI “ 9 990.86 " , Q4 , 05 ; " *

1190 PRINT " 10.3 n 1200 GOTO 1240

1210 PRINT " 96.2 ii 1220 PRINT « * — ii ii " 9 990.86 " , Q 4 , 0

5

1230 PRINT " 10.3 n 1240 PRINT

1250 PRINT

109
1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

LET Q5=3. 5E18*1. 2E15

LET 07=(3. 5El 8*1 . 2E15J-4. 2E33

IF ABS (07) <=1E28 THEN 1330

PRINT " 3.5E18 " PRINT " * ="," 4 . 20000E33 ",Q5,07

PRINT " 1.2E15 " GOTO 1360

PRINT " 3.5E18 " PRINT H * 4. 20000E33 ",Q5,07

PRINT " 1.2E15 " PRINT

PRINT

LET Q6=4E20*2E15

LET 08= (4E20*2E15)-8E35

IF ABS (08) <=1E30 THEN 1450

PRINT " 4E20

PRINT " * = M

, H 8 . 00000E35 ”,06,08

PRINT " 2E15

GOTO 1480

PRINT " 4E20

PRINT " * 8 . 00000E35 ",06,08

PRINT " 2E15

PRINT

PRINT " PRINT

PRINT

END

ii * H

" * "

END TEST n

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 20

BEGIN TEST.

SECTION 20.1

- SUBTRACTION -

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

110
SIX PLACE ACCURACY

MINUEND DIFFERENCE

MINUS REQUIRED OF ABSOLUTE

SUBTRAHEND DIFFERENCE SYSTEM ERROR

956

482

474 474 0

356.41

574.32

15.7E-24

-217.91 -217.91 0

18. 5E-23

-1.69300E-22 -1 . 69300E-22 0

17E20

14E19

1.56000E21 1 . 56000E+21 0

END TEST.

BEGIN TEST.

SECTION 20.2

XXXXXXXXXXXXXXXXXX

X MULTIPLICATION X

XXXXXXXXXXXXXXXXXX

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

'. FACTOR

TIMES REQUIRED PRODUCT OF ABSOLUTE

i. FACTOR PRODUCT SYSTEM ERROR

1425 1425 0

Ill
990.86 990.86 0 96.2

10.3

3. 5E18

* 1. 2E15

4. 20000E33

4E20

* 2E15

8. 00000E35

4 . 20000E+33 0

8 . 00000E+35 0

END TEST.

112
21.6) ELEMENTARY NUMERICAL EXPRESSIONS USING CONSTANTS (CONTINUED)

21.1 Divis

The objective of this test is to veri

between two numerical constants will y

precision. This test computes the quotien

constants, and two NR3 constants. There i first column is labeled "DIVIDEND DIVIDED

labeled "REQUIRED QUOTIENT", the third

SYSTEM", and the fourth column is labeled

ion

fy that the operation of division

ield at least six decimal digits of

t of two NRl constants, two NR2

s a four column output of which the

BY DIVISOR", the second column is

column is labeled "QUOTIENT OF

"ABSOLUTE ERROR".

The first column lists the pairs of numer

the quotient, the second column lists the

third column lists the quotients as evaluated

the fourth column contains the absolute

quotients and the true quotient. An asterisk

failure to maintain six significant digits.

ical constants which enter

standard conforming output

by the system being tested

errors between the gene

to the right would ind

ir

i

into

the

and

ated

cate

21.2 Involution

The objective of this test is to verify that the operation of involution

of numerical constants will yield at least six decimal digits of precision.

This test forms the involution of two NRl constants, two NR2 constants, and

two NR3 constants . Its output falls in four columns again of which the

first column is labeled "BASE ~ EXPONENT", the second column is labeled

"REQUIRED POWER", the third column is labeled "POWER OF SYSTEM", and the

fourth column is labeled "ABSOLUTE ERROR".

The first co have been involu

the third column

system being tes

asterisk appears

maintain six sign

lumn lists the pairs of numerical constants which

ted, the second column lists the standard conforming

lists the involution of the constants as generated

ted, and the fourth column contains the absolute err

to the right of this column as before for fai

ificant digits.

should

output

,

by the

ors. An

lure to

*****************9k*

* PROGRAM FILE 21 * *******************

6)020 PRINT "PROGRAM FILE 21"

0070 PRINT

0080 PRINT

113
0090 PRINT

0100 PRINT

0110 PRINT

3120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

3200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 PRINT

0250 PRINT

0260 PRINT

0270 PRINT

0280 PRINT

0290 PRINT

0300 PRINT

0310 LET Rl=105/5

0320 LET Z3=(105/5)-21

0330 IF ABS ( Z 3 ) < = lE-4 THEN 380

0340 PRINT " 105

0350 PRINT " /

= "," 21 ",Rl,Z3;"*"

0360 PRINT ” 5 0370 GOTO 410

0380 PRINT ’* 105

0390 PRINT " /

= "," 21 " , Rl , Z 3 0400 PRINT " 5 0410 PRINT

0420 PRINT

0430 LET R2=6. 2/0.

5

0440 LET 0 6 =(6.2/0. 5) -12. 4 0450 IF ABS (06) <=lE-4 THEN 500

0460 PRINT " 6.2 II 0470 PRINT " /

II II 9 12.4 " ,R2, 06; "*" 0480 PRINT " 0.5 II 0490 GOTO 530

0500 PRINT " 6.2 II 0510 PRINT " /

it n

t 12.4 " ,R2, 06

0520 PRINT " 0.5 ii 0530 PRINT

0540 PRINT

0550 LET R3 =1. 0E29/5. 0E10

0560 LET Q8 = ( 1 . 0E29/5 . 0E10 ) -2 . E18

0570 IF ABS (Q8) <=1E13 THEN 620

0580 PRINT " 1.0E29 II 0590 PRINT " /

II II 9 2. 00000E18 " ,R3,Q8;

0600 PRINT " 5.0E10 II 0610 GOTO 650

0620 PRINT " 1.0E29

0630 PRINT " /

II II 9 2. 00000E18 " ,R3,Q8

0640 PRINT " 5.0E10 II 0650 PRINT

BEGIN TEST."

" SECTION 21.1"

" ////////////"

" / DIVISION /"

" ////////////"

" IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OF OF"

"SIX PLACE ACCURACY."

" DIVIDEND " "DIVIDED BY" , "REQUIRED" , "QUOTIENT OF" , "ABSOLUTE"

" DIVISOR ", "QUOTIENT" , " SYSTEM "

, " ERROR "
0660 PRINT

0670 LET R4 =15E30/5E15

0680 LET 09 = (15E30/5E15) -3E15

0690 IF ABS (09) <=1E10 THEN 740

0700 PRINT " 15E30 II 0710 PRINT " / ="," 3.00000E15 " , R4 , 09 ; "

" 0720 PRINT " 5E15 H 0730 GOTO 770

0740 PRINT " 15E30 •« 0750 PRINT " / ="," 3.00000E15 "

, R4 , 09

0760 PRINT " 5E15 n 0770 PRINT

0780 PRINT

0790 PRINT N END TEST."

0800 PRINT

0810 PRINT

0820 PRINT

0830 PRINT n SECTION 21.2"

0840 PRINT

0850 PRINT ii 0853 PRINT ii ''INVOLUTION'"

0855 PRINT n AAAAAAAAAAAA,,

0860 PRINT

0870 PRINT

0880 PRINT i» BEGIN TEST."

0890 PRINT

0900 PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE

0910 PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

0920 PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE0930 PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-i

0940 PRINT "SIX PLACE ACCURACY."

0950 PRINT

0960 PRINT

0970 PRINT " BASE II 0980 PRINT n * "

, "REQUIRED" , "POWER OF" , "ABSOLUTE"

0990 PRINT "EXPONENT”," POWER "," SYSTEM ERROR " 1000 PRINT

1010 PRINT

1020 LET R5 = 30 '

2

1030 LET S5 = (30'2) - 900

1040 IF ABS (S 5 ) < = 1E -3 THEN 1090

1050 PRINT " 30 II 1060 PRINT H A ="," 900 "

, R5 , S5 ; " *

1070 PRINT " 2

n 1080 GOTO 1120

1090 PRINT " 30 n 1100 PRINT II A = "," 900 "

,

R 5 , S 5 1110 PRINT " 2

n 1120 PRINT

1130 PRINT

1140 LET T5 =0'0

1150 LET U5 = ( 0 '

0

) -1

1160 IF ABS (U

5

) < = 1E -5 THEN 1210

1170 PRINT " 0

n 1180 PRINT II A ="," 1 ",T5,U5;"*“

1190 PRINT " 0

II 1200 GOTO 1240

115
1210 PRINT " 0 1220 PRINT " * 1 " ,T5,U5

1230 PRINT " 0 1240 PRINT

1250 PRINT

1260 LET W5-5.0" (-2.0)

1270 LET X5=(5. 0~ (-2. 0) )-. 04

1280 IF ABS (X5) <=lE-6 THEN 1330

1290 PRINT “5.0

1300 PRINT " * = .04 " ,W5,X5;

1310 PRINT "-2.0

1320 GOTO 1360

1330 PRINT " 5.0

1340 PRINT " * .04 "

, W 5 , X 5 1350 PRINT "-2.0

1360 PRINT

1370 PRINT

1380 LET X2 = 90.E-2'\2E01

1390 LET X3=(90.E-2".2E01)-81.E-2

1400 IF ABS (X3) <=lE-6 THEN 1450

1410 PRINT " 90.E-2 " 1420 PRINT " “ = .81 " , X2 , X3 ; " *

1430 PRINT " . 2E01 " 1440 GOTO 1480

1450 PRINT " 90.E-2 " 1460 PRINT " * .81 ",X2,X3

147 0 PRINT " . 2E 0 1

" 1480 PRINT

1490 PRINT

1500 LET X4 = 4E 4 5 0E-2

1510 LET Y4=(4E4~50E-2)-2E2

1520 IF ABS (Y4) <=lE-3 THEN 1570

1530 PRINT tl 4E4 N 1540 PRINT II _ ii m

i 200 " ,X4,Y4;

1550 PRINT II 50E-2 n 1560 GOTO 1600

1570 PRINT n 4E4 ii 1580 PRINT ii _ ii it t 200 " ,X4 , Y4

1590 PRINT ii 50E-2 ii 1600 PRINT

1610 PRINT

1620 PRINT «i END TEST.

1630 PRINT

1640 PRINT

1650 END

*****************

* SAMPLE OUTPUT * *****************

116
PROGRAM FILE 21

BEGIN TEST.

SECTION 21.1

////////////

/ DIVISION /

////////////

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OF OF

SIX PLACE ACCURACY.

DIVIDEND

DIVIDED BY REQUIRED QUOTIENT OF ABSOLUTE

DIVISOR QUOTIENT SYSTEM ERROR

105

/ = 21 21 0

5

6.2

/ = 12.4 12.4 0 0.5

1.0E29

/ = 2.00000E18 2 . 00000E+18 0 5. 0E10

15E30

/

= 3.00000E15 3. 00000E+15 0 5E15

END TEST.

SECTION 21.2

INVOLUTION

BEGIN TEST.

117
IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

BASE

EXPONENT

REQUIRED

POWER

POWER OF

SYSTEM

ABSOLUTE

ERROR

30

2 900 900 0

0

0

1 1 0

5.0

-2.0

. 04 0.04 0

90. E-2

. 2E01

. 81 0.81 0

4E4

50E-2

200 200. 0

END TEST.

118
22.0

ELEMENTARY EXPRESSIONS USING SIMPLE VARIABLES

The objective here is to extend the construction process of numerical

expressions by using simple numeric variables with the operations of

addition, subtraction, multiplication, division, and involution. Each test

is constructed to use only simple variables assigned the same type of

numerical constants with each other, that is, simple variables that have been

assigned NRl constants are not used with simple variables that have been

assigned NR2 or NR3 constants, etc.

22.1

Addition

The objective of this test is to verify that the operation of addition

of two numerically assigned simple variables will yield at least six decimal

digits of precision. This test is similar to test 19.3, except for the

simple variables and the values of their assigned numerical constants. The

labeling of the first column is different in that for this test the first

column is labeled "Assignment 1 plus Assignment 2". This test generates the same output format as in test 19.3.

22.2

Subtraction

The objective

subtraction

six decimal

except for

labeling of

column is

the same as

of this test is to verify that the operation of

of two numerically assigned simple variables will yield at least

digits of precision. This test is similar to test test 20.1,

the simple variables and their assigned

the first column is different, in that,

labeled "Assignment 1 minus Assignment

20 . 1 .

numerical constants. The

for this test the first

2". The output format is

that in

*******************

* PROGRAM FILE 22 * ft******************

0010 PRINT "PROGRAM FILE 22"

0060 PRINT

0070 PRINT

0080 PRINT

0140 PRINT " 0150 PRINT

0160 PRINT

0170 PRINT " 0180 PRINT

0190 PRINT '* 0200 PRINT "

BEGIN TEST.”

SECTION 22.1"

If + ADDITION +"

119
0210

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

0 500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0 6 0 0 0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

PRINT " ++++++++++++"

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT " A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " PLUS ", "REQUIRED" , "SUM OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2"," SUM ", "SYSTEM"," ERROR " PRINT

PRINT

LET K2 = 2 LET K3=-12

LET K4=K2+K3

LET Zl=10

LET Xl=K4+Z

1

IF ABS (XI) < = lE-4 THEN 450

PRINT "2

PRINT " + =","-10 ",K4,X1;"*"

PRINT " -12

GOTO 480

PRINT " 2 PRINT " + =","-10 " , K 4 , X

1

PRINT " -12

PRINT

PRINT

LET M4=10 .

5

LET M5=-32.

5

LET M8=M4+M5

LET Z 2 = 22 .

0

LET X2=M8 + Z 2 IF ABS (X2 ) <=lE-4 THEN 600

PRINT " 10.5

PRINT " + =","-22.0 " ,M8,X2; "** PRINT "-32.5

GOTO 630

PRINT "10.5

PRINT " + =","-22.0 " , M 8 , X

2

PRINT "-32.5

PRINT

PRINT

LET N 4 = 2 . 5E20

LET N 5 = 3 . 5E 21

LET N 6=N 4 +N 5 LET Z 3=-3 . 7 5E 21

LET X3=N 6 + Z 3 IF ABS (X3) <=1E16 THEN 750

PRINT " 2. 5E20 II PRINT " +

_ II II 9 3. 75000E21 " ,N6,X3;"*"

PRINT " 3. 5E21 II GOTO 780

PRINT " 2. 5E20 H PRINT " +

_ It II 9 3. 75000E21 " ,N6,X3

PRINT " 3. 5E21 It

120
0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

PRINT

PRINT

LET K5=3E20

LET K6=4E20

LET K7=K 5+K

6

LET Z4=-7E20

LET X4=K 7+Z 4 IF ABS (X4) <=1E15 THEN 900

PRINT " 3E20

PRINT " + PRINT " 4E20

GOTO 930

PRINT ” 3E20

7 . 00000E20 " , K7 , X4 ; " *

7 . 00000E20 " , K7 , X4

END TEST.

BEGIN TEST."

SECTION 22.2'

PRINT " + PRINT " 4E20

PRINT

PRINT " PRINT

PRINT

PRINT

PRINT " PRINT

PRINT

PRINT " PRINT

PRINT " PRINT M PRINT " " PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT

- SUBTRACTION

PRINT " MINUS "," REQUIRED ' PRINT "ASSIGNMENT 2" , "DIFFERENCE'

PRINT

PRINT

LET K8=156

LET K9=6

LET L5=K 8-K

9

LET Z 5=150

LET Yl=L5-Z 5 IF ABS (Yl) <=lE-3 THEN 1290

PRINT " 156

, "DIFFERENCE*

OF

," SYSTEM

", "ABSOLUTE"

ERROR "

PRINT " - PRINT " 6 GOTO 1320

PRINT " 156

PRINT " - PRINT " 6 PRINT

PRINT

LET Ll-2 . 55

156 " , L 5 , Y 1

; " *

150 " , L5 , Y

1

121
1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

LET L8=-12 . 55

LET L9=L8-L7

LET Z 6=-l 5 .

1

LET Y 2=L9-Z

6

IF ABS ( Y 2 ) <=1E~4 THEN 1440

PRINT " - 1 2 . 5

5

PRINT “ PRINT " 2.55

GOTO 1470

PRINT "-12.55

PRINT " PRINT " 2.55

PRINT

PRINT

LET A4=2. 55E20

LET A5=-2 . 55E20

LET M6=A4-A5

LET Z 7 = 5 . IE 20

LET Y3=M6-Z7

IF ABS ( Y 3 ) < = 1E15 THEN 1590

PRINT " 2.55E20 " PRINT " PRINT "-2.55E20

GOTO 1620

PRINT " 2.55E20

PRINT " PRINT "-2.55E20 " PRINT

PRINT

LET M7=1E30

LET M3=19E30

LET M9=M3-M7

LET Z8=18E30

LET Y=M9-Z8

IF ABS (Y4) <=1E26 THEN 1740

PRINT " 19E30

PRINT " PRINT " IE 30

GOTO 1770

PRINT " 19E30

-15.1 " , L9 , Y 2; " *

= ","-15.1 " , L 9 , Y 2

5.10000E20 " , M 6 , Y 3

; "

1

5 . 10000E20 ",M6,Y3

1.80000E30 ",M9,Y4;

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

END

1E30

1.80000E30 " , M9 , Y4

END TEST M

*****************

* SAMPLE OUTPUT * *****************

122
PROGRAM FILE 22

BEGIN TEST.

SECTION 22.1

+ ADDITION +

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 PLUS REQUIRED SUM OF ABSOLUTE

ASSIGNMENT 2 SUM SYSTEM ERROR

2+ = -12

-10 -10 0

10.5

+ = -32.5-22.0 -22 0

2.5E20

+ =

3. 5E21

3. 75000E21 3. 75000E+21 0

3E20

+ = 4E20

7. 00000E20 7. 00000E+20 0

END TEST.

BEGIN TEST.

SECTION 22.2

- SUBTRACTION -

123
IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 DIFFERENCE

MINUS REQUIRED OF ABSOLUTE

ASSIGNMENT 2 DIFFERENCE SYSTEM ERROR

156

- - 150 150 0

6

-12.55

- -15. 1 -15. 1 0

2. 55E20

-2. 55E20

5.10000E20 5 . 1 00 00E+20 0

19E30

1E30

1.80000E30 1 . 80000E+31 0

END TEST.

124
23.0

ELEMENTARY EXPRESSIONS USING SIMPLE VARIABLES (CONTINUED)

23.1

Multiplication

The objective of this test is to verify that the operation of

multiplication between two numeric assigned simple variables will yield an accuracy of at least six decimal digits of precision. The test is similar to

test 20.2, except for the simple variables and the values of their assigned

numerical constants. The labeling of the first column is different in that

for this test the first column is labeled "Assignment 1 times Assignment 2“.

Finally, this test has the same output format as test 20.2.

23.2

Division

The objective of this test is to verify that the operation of division

between two numerically assigned simple variables will yield an accuracy of

at least six decimal digits of precision. The test is similar to test 21.1,

except for the simple variables and the values of their assigned numerical

The labeling of the first column is different in that for this

column is labeled "Assignment 1 divided by Assignment 2."

constants

.

test the first

Again, this test has the same output format as test 21.1.

23.3 Involution

The objective of this test is verify that the operation of involution

between two numerically assigned simple variables will yield an accuracy of

at least six decimal digits of precision. The test is similar to test 21.2,

except for the simple variables and the values of their assigned numerical

constants

test

test

The labeling of the first column is different in that for this

the first column is labeled "Assignment 1

~ Assignment 2." Again, this

has the same output format as test 21.2.

*******************

* PROGRAM FILE 23 * *******************

0010 PRINT "PROGRAM FILE

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT " 0100 PRINT

0110 PRINT

0120 PRINT " 0130 PRINT

II

BEGIN TEST."

SECTION 23.1"

125
014 0 0150

0160

0170

0180

0190

0200

0210

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

PRINT " XXXXXXXXXXXXXXXXXX"

PRINT " X MULTIPLICATION X"

PRINT H XXXXXXXXXXXXXXXXXX”

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT “SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " TIMES ", "REQUIRED" , "PRODUCT OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2", "PRODUCT SYSTEM ERROR " PRINT

PRINT

LET Vl=l

5

LET V2=20

LET U 1=V 1 *V2

LET Al=300

LET X5=U 1-Al

IF ABS (X5) <=lE-3 THEN 400

PRINT "15

300 " , U 1 , X 5

; " *

PRINT " * PRINT " 20

GOTO 430

PRINT "15

PRINT " * 300 " , U 1 , X5

PRINT " 20

PRINT

PRINT

LET V3=3 .

6

LET V4=4 .

2

LET U 2=V 3 *V4

LET A2=15 . 12

LET X6=U 2-A2

IF ABS (X6 ) <=lE-4 THEN 550

PRINT "3.6

PRINT " * PRINT " 4.2

GOTO 580

PRINT "3.6

PRINT " * PRINT " 4.2

PRINT

PRINT

LET V5=3.6E15

LET V6=l . 2E 3 LET U3=V5*V6

LET A3=4 . 32E18

LET X7=U 3-A3

15.12 " , U 2 , X6 ; " *

'

15.12 " , U 2 , X 6

IF ABS ( X 7 ) < = 1E 1 3 THEN 700

PRINT " 3.6E15 " PRINT " * ="," 4. 3200 0E 18 “,U3,X7;"*"

PRINT " 1.2E3 " GOTO 730

PRINT " 3.6E15 "

126
071k)

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

* 1. 2E3

PRINT

PRINT

PRINT

PRINT

LET V7=3E18

LET V8=2E-3

LET V9=V7*V8

LET A4=6E15

LET X8=V9-A4

IF ABS ( X 8 ) < = 1E10 THEN 850

PRINT " 3E18

4.32000E18 " , U 3 , X

7

PRINT " * PRINT ” 2E-3

GOTO 880

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

3E18

* 2E-3

6.00000E15 ",V9,X8;"*“

6 . 00000E15 "

, V 9 , X 8

END TEST.

BEGIN TEST.”

SECTION 23.2"

////////////"

/ DIVISION /"

////////////"

"ASSIGNMENT 1"

" DIVIDED BY "

, "REQUIRED" , "QUOTIENT OF "

, "ABSOLUTE*

ERROR '

" IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT

PRINT

PRINT "ASSIGNMENT 2

"

, "QUOTI ENT" , " SYSTEM

PRINT

PRINT

LET Sl=15

LET S2=5

LET U4=S1/S2

LET A5=3

LET Y5=U4-A5

IF ABS (Y5) <=lE-5 THEN 1240

PRINT "15 " PRINT " /

PRINT " 5 GOTO 1270

PRINT " 15

PRINT " /

PRINT " 5 PRINT

3 "

, U 4 , Y 5 ; " * "

3 "

, U 4 , Y 5

127
1280 PRINT

1290 LET S3=14.2

1300 LET S 4 =7 .

1

1310 LET U5=S3/S4

1320 LET A6=2 .

0

1330 LET Y6=U5-A6

1340 IF ABS (Y6) < = lE-5 THEN

1350 PRINT " 14.2 N 1360 PRINT " /

n n

9 2 1370 PRINT " 7.1 ii 1380 GOTO 1420

1390 PRINT " 14.2 M 1400 PRINT " /

H II 9 2 1410 PRINT " 7.1 II 1420 PRINT

1430 PRINT

1440 LET Q7=3. 5E30

1450 LET Q9=7. 0E10

1460 LET U6=Q 7/Q9

1470 LET A7=5 . 0E 1

9

1480 LET Y7=U6-5. 0E19

1490 IF ABS (Y7) <=1E14 THEN

1500 PRINT " 3.5E30 m 1510 PRINT " /

m n

9 5 1520 PRINT " 7.0E10 M 1530 GOTO 1570

1540 PRINT " 3.5E30 M 1550 PRINT " /

H M

9 5 1560 PRINT " 7.0E10 II 1570 PRINT

1580 PRINT

1590 LET S5=18E20

1600 LET S6=9E-2

1610 LET U7=S5/S6

1620 LET A8 = 2E 22

1630 LET Y8=U7-2E22

1640 IF ABS ( Y8 ) <=1E17 THEN

1650 PRINT " 18E20 II 1660 PRINT " /

II N

9 2 1670 PRINT " 9E-2 II 1680 GOTO 1720

1690 PRINT " 18E20 II 1700 PRINT " /

II M

9 2 1710 PRINT " 9E-2 II 1720 PRINT

1730 PRINT " 1740 PRINT

1750 PRINT

1760 PRINT

1770 PRINT " 1780 PRINT

1790 PRINT " 1793 PRINT " 1795 PRINT " 1800 PRINT

1810 PRINT

1820 PRINT "

1390

0 ",U5,Y6;"*"

0 ",U5,Y6

1540

00000E19 ",U6,Y7;"*"

00000E1 9 "

, U 6 , Y

7

1690

00000E22 " ,U7,Y8;"*"

00E22 m ,U7,Y8

END TEST."

SECTION 23.3" aaaaaaaaaaaa n "INVOLUTION""

BEGIN TEST."

128
133 ) 134 ) 185 » 136 ) 187 I 188 ) 189 ) 198 J 1919

192 J 1939

1940

1950

1960

1970

1900

1990

2009

2010

2020

2039

204 0

2050

2064

2070

2080

2090

2100

2110

212U

2130

2140

2150

2160

2170

2180

2190

2200

2210

222(1

223(1

2240

2251

2261

2271

2281

2291

2301

2311

2321

2331

2341

2350

2361

2371

238[

2391

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERRORPRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " “ ", "REQUIRED" , "POWER OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2"," POWER "," SYSTEM ERROR " PRINT

PRINT

LET T6=-5

LET U6=4

LET W 6 =T 6

~ U 6

LET Bl = 62 5 LET T7=W6-B1

IF ABS (T7) <=lE-3 THEN 2060

PRINT "-5

PRINT " * ="," 625 ",W6,T7;"*“

PRIKT "4

GOTO 2090

PRINT "-5

PRINT " ** =" ," 625 ",W6,T7

PRINT " 4 PRINT

PRINT

LET R6=. 625

LET S6=0 .

0

LET X6=R6~S6

LET B2=l .

0

LET Y6=X6-B2

IF ABS (Y6) <=lE-5 THEN 2210

PRINT " .625

PRINT " * =

"

, " 1 " , X6 , Y 6

; " *

PRINT "0.0

GOTO 2240

PRINT " .625

PRINT " " =" ," 1 ",X6,Y6

PRINT "0.0

PRINT

PRINT

LET T8=- . 005E3

LET U7=-200.E-2

LET W7 =T 8

~ U 7 LET B3=4 . 0E-2

LET X7=W7-B3

IF ABS (X7) <=lE-6 THEN 2360

PRINT "- . 005E3

PRINT " * .04 " , W 7 , X 7

; " *

PRINT "-200. E-2 " GOTO 2390

PRINT " - . 005E

3

PRINT " * = .04 " , W 7 , X

7

PRINT "-200. E-2 " PRINT

129
2400 PRINT

2410 LET Y7=4 0 0E-2

2420 LET Y8=5E-1

2430 LET W8=Y7'

s Y8

2440 LET B 4 = 20 0E-2

2450 LET W9=W8-B4

2460 IF ABS (W9) < = lE-5 THEN 2510

2470 PRINT " 400E-2

2480 PRINT " * 2 ",W8,W9;"*"

2490 PRINT " 5E-1

2500 GOTO 2540

2510 PRINT " 400E-2

2520 PRINT ” “ = 2 " ,W8,W9

2530 PRINT u 5E-1

2540 PRINT

2550 PRINT " END TEST."

2560 PRINT

2570 PRINT

2580 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 23

BEGIN TEST.

SECTION 23.1

XXXXXXXXXXXXXXXXXX

X MULTIPLICATION X XXXXXXXXXXXXXXXXXX

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 TIMES REQUIRED PRODUCT OF ABSOLUTE

ASSIGNMENT 2 PRODUCT SYSTEM ERROR

130
300 300 0 15

*20

3.6

X 4.2

15.12 15.12 0

3. 6E15

* 1. 2E3

4 . 32000E18 4 . 32000E+18 0

3E18

* 2E-3

6 . 00000E15 6 . 00000E+15 0

END TEST.

BEGIN TEST.

SECTION 23.2

////////////

/ DIVISION /

////////////

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 DIVIDED BY REQUIRED

ASSIGNMENT 2 QUOTIENT

QUOTIENT OF ABSOLUTE

SYSTEM ERROR

15

/ = 3 3 0

5

14.2

/ = 2.0 2 0 7.1

3. 5E30

/ = 5.00000E19 5 . 00000E+19 0 7. 0E10

131
18E20

/ = 2.00000E22 2 . 00000E+22 0 9E-2

END TEST.

SECTION 23.3

INVOLUTION'

BEGIN TEST.

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 REQUIRED POWER OF ABSOLUTE

ASSIGNMENT 2 POWER SYSTEM ERROR

-5

4 625 625 0

. 625

0.0

1 0

005E3

-200. E-2

. 04 . 04 0

400E-2

5E-1

2 0

END TEST.

132
24.0

ELEMENTARY OPERATIONS ON MIXED TYPE CONSTANTS

The objective of the next few tests is to determine whether the terms of

a numerical expression can be of mixed type, that is, whether NRl constants

can be added to NR2 or NR3 constants, whether NRl or NR2 constants can be

subtracted from NR3 constants, etc. For this test section, each sub-test

will at most use two terms, since expressions with more than two terms will

be tested later. The reader should remember that the word type here only

refers to graphical form and not to the formal meaning of a typed constant or variable as in FORTRAN, for example. The reader should be familiar with

section 7 of BSR X3.60 at this point.

24.1

Add i t ion

The objective of this test is to verify that the operation of addition

on two numerical constants that are not of the same type will still yield

accuracy of at least six decimal digits of precision. The test is similar to

test 19.3, except for the mixing of types and the labeling of the first

output column which for this test is labeled "1st Addend plus 2nd Addend".

This test has the same output format as test 19.3.

24.2

Subtraction

The

subtr acti

maintain

test 20.

label i ng

format as

objective of this tes on between two numeric

at least six decimal digi

1, except for the mix

of the first column outpu

test 20.1.

tal

ts

i ng

t

.

is to verify that the operation of

constants, not of the same type, will

of precision. The test is similar to

of types, and the word minus used in

Finally this test has the same output

* * * ****************

* PROGRAM FILE 24 * *******************

0010 PRINT "PROGRAM FILE 24"

0060 PRINT

0070 PRINT

0030 PRINT

0090 PRINT " 0100 PRINT

0110 PRINT

0120 PRINT

0180 PRINT " 0190 PRINT

0200 PRINT

0210 PRINT "

SECTION 24.0: PRIMITIVE OPERATIONS ON MIXED MODES."

BEGIN TEST."

SECTION 24.1"

133
322 J 0230

0240

023 I 0 26 I 0 27 I J 23 ) 029 I 0300

0310

0320

0 33 ) 0 34 I 035 i 0 36 I 037 J 0330

0390

040 ) 041 I J 4 2 I 3430

344 I 3453

0463

0470

043 3 049 3 0 503

0513

0520

0530

0540

0 550

0 5613 0570

0 580

0590

0600

0610

0626

0630

06' I 0 650

0660

0670

0680

0690

0706

071

0

0720

0730

0 740

0750

0760

0770

0780

PRINT

PRINT " ++++++++++++"

PRINT " + ADDITION +" PRINT " ++++++++++++"

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

.PRINT "1ST. ADDEND"

PRINT " + ", "REQUIRED" , "SUM OF" , "ABSOLUTE"

PRINT "2ND. ADDEND"," SUM "/’SYSTEM"," ERROR " PRINT

LET A $ = " " LET R8=12+2 .

5

LET S8= (12+2. 5) + (-14 . 5)

I ? ABS ( S 8 ) < = lE-4 THEN 430

LET A $ = " * " PRINT "12

PRINT " + ="," 14.5 " , R8 , S8 ; A $

PRINT "2.5

PRINT

LET A $ = " " LET S 9=1 4 +12. 5E-3

LET T8= (14+12. 5E-3)+ (-14. 0125)

I? ADS (T8) <=lE-4 THEN 520

LET A$= " *

PRINT "14

PRINT " + ="," 14.0125 " ,S9,T8;A$

PRINT " 12.5E-3

PRINT

LET A $ = " " LET R9=-9+ (-15E-4)

LET T9= (-9+ (-15E-4) ) +9.0015

IF ADS (T9) <=lE-5 THEN 610

LET A$=" *

PRINT " -9

PRINT " + =","-9.0015 " , R9 , T9 ; A $

PRINT "-15E-4

PRINT

LET A$=" ” LET U8=.625+(-. 00005E7)

LET U9= ( . 625+ (-. 0000 5E 7) J+499.375

IF ABS ( U 9 ) < = lE-3 THEN 700

LET A$= " *

PRINT " .625

PRINT " + =","-499.375 ",U8,U9;A$

PRINT "— . 000 0 5E 7 PRINT

LET A $ = " " LET W 8=1234. 2+36000E-5

LET X9= (1234. 2+36000E-5) + (-1234.56)

IF ABS ( X 9 ) < = lE-2 THEN 790

LET A$=" *

13U
079 3 0303

0310

082 3 0330

034 3 0350

0360

0870

0880

0890

0900

0910

0920

0933

0943

0 95 3 0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

125E

1260

1270

1280

1290

1300

1310

1320

1330

134 0 1350

PRINT " 1234.2

PRINT " + = "," 1234.56 ",W8,X9;A$

PRINT " 36000E-5

PRINT

LET A$=" " LET X8=65. 4321E21+12345E17

LET W9= (65. 432lE21+12345El7)+(-6. 66666E22)

IF ABS (W9) <=1E17 THEN 880

LET A$= " *

PRINT " 65. 4321E21 " PRINT " + 6 . 66666E22 ",X8,W9;A$

PRINT " 12345E17

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT

PRINT " SECTION 24.2"

PRINT

PRINT " " PRINT " - SUBTRACTION

PRINT " " PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT " MINUEND "

, "DIFFERENC E" PRINT " - REQUIRED OF ABSOLUTE"

PRINT "SUBTRAHEND" /'DIFFERENCE" ," SYSTEM ERROR " PRINT

LET A$= " " LET Y8 =2 -.76544

LET Y9= (2-. 76544) -1.23456

IF ABS (Y9) <=lE-5 THEN 1210

LET A$ = " * " PRINT "2

PRINT " - 1.23456 ",Y8,Y9;A$

PRINT " .76544

PRINT

LET A$=" " LET Z8=15- (-. 00520E3)

LET Z9= (15- (-. 00520E3) )-20.20

IF ABS ( Z 9 ) < = lE-4 THEN 1300

LET A $ = " *

PRINT "15

PRINT " - =" ," 20.2 ",Z8,Z9;A$

PRINT "-. 00520E3

PRINT

LET A$=" " LET A=-9-87600E-5

135
1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

LET B0=(-9-87600E-5)-(-9.876)

IF ABS (B0) <=lE-5 THEN 1390

LET A$=" *

PRINT " -9 M PRINT " - =","-9.876 ",A,B0;A$

PRINT " 87600E-5 " PRINT

LET A$=" " LET Cl=8. 8-. 000231E6

LET D2=(8.8-.00023lE6)-(-222.2)

IF ABS (D2) <=lE-3 THEN 1480

LET A$=" *

PRINT " 9.8

PRINT " - =","-222.2 ",C1,D2;A$

PRINT " . 000231E6

PRINT

LET A$= " " LET E3=177.177-540540E-4

LET F4= (177. 177-540540E-4) -123. 123

IF ABS ( F 4 ) < = lE-3 THEN 1570

LET A $ = " *

PRINT ° 177.177

PRINT " - ="," 123.123 ",E3,F4;A$

PRINT " 540540E-4

PRINT

LET A$=" " LET G5=-90.1233E20-(-12345El6)

LET H6=(-90. 1233E20-(-12345El6) )-(-8.88888E21)

IF ABS (H6) <=1E16 THEN 1660

LET A$= " *

PRINT "-90.1233E20 " PRINT " - =" , "-8. 88888E21 ",G5,H6;A?

PRINT " -12345E16

PRINT

PRINT " END TEST

PRINT

PRINT

END

N

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 24

SECTION 24.0: PRIMITIVE OPERATIONS ON MIXED MODES.

136
BEGIN TEST

SECTION 24.1

+ ADDITION +

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

1ST. ADDEND

+ REQUIRED SUM OF ABSOLUTE

2ND. ADDEND SUM SYSTEM ERROR

12

+ = 14.5 14.5 0 2.5

14

+ = 14.0125 14.0125 0 12.5E-3

-9

+ = -9.0015 -9.0015 0 -15E-4

. 625

+ = -499.375 -499.375 0 -. 00005E7

1234.2

+ = 1234.56 1234.56 0 36000E-5

65. 4321E21

+ = 6.66666E22 6. 66666E+22 0 12345E17

END TEST.

BEGIN TEST.

SECTION 24.2

- SUBTRACTION -

137
IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, CHECK TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, CHECK TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

6

MINUEND DIFFERENCE

- REQUIRED OF ABSOLUTE

SUBTRAHEND

2

DIFFERENCE SYSTEM ERROR

.76544

15

= 1.23456 1.23456 0

- . 00520E3

-9

= 20.2 20.2 0

87600E-5

9.8

= -9.876 -9.8-76 0

.000231E6

177.177

= -222.2 -222.2 0

540540E-4

-90. 1233E20

= 123.123 123.123 0

-12345E16

= -8.88888E21 -8. 88888E+21 0

END TEST.

138
25.0

ELEMENTARY OPERATIONS ON MIXED TYPE CONSTANTS (CONTINUED)

25.1

Multiplication

The objective of this test is to verify that the operation of

multiplication of two numerical constants that are not of the same type will

maintain at least six decimal digits of precision. The test is the same as test 20.3, except for the mixing of types. This test has the same output

format as test 20.3.

25.

2

Division

The objective of this test is to verify that the operation of division

between two numerical constants that are not of the same type will maintain

at least six decimal digits of precision. The test is the same in structure

as test 21.1, except for the mixing of types. This test has the same output

format as test 21.1.

25.3

Involution

The objective of this test is to verify that the operation of involution

between two numerical constants that are not of the same type will maintain

at least six decimal digits of precision. The test is the same structurally

to test 21.2, except for the mixing of types. This test has the same output

format as test 21.2.

*******************

* PROGRAM FILE 25 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

"PROGRAM FILE 25"

BEGIN TEST."

" SECTION 25.1"

" XXXXXXXXXXXXXXXXXX"

" X MULTIPLICATION X"

" XXXXXXXXXXXXXXXXXX"

" IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

139
0200

0210

0220

0230

0240

0250

0263

0270

0280

0290

0303

0313

0320

0 33 0 0340

0353

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0 5 7 0 0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0 7 0 0 0710

0720

0730

0740

0750

0

7 60

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "1ST. FACTOR"

PRINT " * " /’REQUIRED" /'PRODUCT OF" /’ABSOLUTE"

PRINT "2ND. FACTOR" , "PRODUCT SYSTEM " /’ ERROR " PRINT

LET A$ = " " LET 17=5*1.25

LET J8= (5*1 . 25) -6. 25

IF ABS ( J 8 ) < = lE-5 THEN 340

LET A$=" *

PRINT " 5 PRINT " * ="," 6.25 " , I 7 , J 8 ; A $

PRINT "1.25 " PRINT

LET A$ = " " LET J9=21* (-. 47619E5)

LET K9= (21* (-. 47619E5) ) - (-999999)

IF ABS ( K 9 ) < = 1E0 THEN 430

LET A$=" *

PRINT " 21

PRINT " * =","-999999 ",J9,K9;A$

PRINT "-. 4 7 6 1 9E 5 PRINT

LET A $ = " " LET B=-99* (-919100E-2)

LET C0=(-99* (-919100E-2) )-909909

IF ABS (C0) < = 1E0 THEN 520

LET A $ = " *

PRINT " -99

PRINT " * ="," 909909 " , B , C 0 ; A $

PRINT "-919100E-2 " PRINT

LET A$=" " LET Dl=. 0015*6. 25E4

LET E2=(. 0015*6. 25E4)-93. 75

IF ABS (E2 ) < = lE-4 THEN 610

LET A

$="*’’

PRINT " .0015

PRINT " * ="," 93.75 ",D1,E2;A$

PRINT " 6.25E4

PRINT

LET A$=" " LET F3=l . 92*6430E-4

LET G4= (1. 92*6430E-4) -1. 23456

IF ABS (G4 ) <=lE-5 THEN 7 00

LET A $ = " *

PRINT " 1.92

PRINT " * ="," 1.23456 ",F3,G4;A$

PRINT " 6433E-4

PRINT

LET A$=" " LET H5=10. 631E27* (-72000E5)

LET I 6= ( 10 . 631E27* (-72000E5) )- (~ 7 . 65432E37)

ll+O
0 7 7 0 07(0

0790

081)0

0810

0820

0830

0840

0850

0860

08-70

0880

0 890

0900

09.-0

0920

0930

0940

0950

0960

09 '7 0

0930

0990

1000

1010

1020

1030

1040

1050

10u0

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1130

1130

1230

1210

1220

1230

124 0 1250

1260

12 70

12 30

12 33

1300

1310

1320

1333

IP ABS (16) <=1E32 THEN 790

LET A$="*"

PRINT " 10. 6 3 IE 27 " PRINT " * - 7.6543 2E 37 ",H5,I6;A$

PRINT "-72000E5

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT

PRINT " SECTION 25.2"

PRINT

PRINT " ////////////"

PRINT " / DIVISION /"

PRINT " ////////////"

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

3 RINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

> LINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

, RINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "DIVIDEND"

PRINT " /

", "REQURIED" , "QUOTIENT OF" , "ABSOLUTE"

PRINT "DIVISOR "/’QUOTIENT"," SYSTEM ERROR " PRINT

LET A$= " " ..ET D=625/l . 25

j3T D0=(625/1.25)-500

IF ABS (D0) <=lE-3 THEN 1120

jET A$="*"

PRINT "625

PRINT " / ="," 500 " ,D,D0;A$

3 RINT "1.25

PRINT

LET A$=" " L3T El=84. 876E7/(-6875)

LET F2= (84. 876E7/ (-6875) )- (-123456)

IF ABS (F2 ) < = 1E0 THEN 1210

LET A $ = " *

PRINT " 84.876E7 " PRINT " / =","-123456 " ,El,F2;A$

PRINT " -6875

PRINT

jET A$ = " " LET G2=-l 98765/ (-5E-20)

LET H3= (-198765/ (-5E-20) J-3.9753E24

IF ABS ( H 3 ) < = 1E19 THEN 1300

LET A$=" *

PRINT " -198765

PRINT " / ="," 3.9753E24 ",G2,H3;A$

PRINT "-5E-20

PRINT

lUl
1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1673

1675

1680

1690

1700

1-710

1"720

1730

1740

1750

1760

17-70

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

LET A$

LET 14

LET J5

IF ABS

LET A $

PRINT

PRINT

PRINT

PRINT

LET A$

LET K4

LET L5

IF ABS

LET A$

PRINT

PRINT

PRINT

PRINT

LET A$

LET K5

LET L6

IF ABS

LET A$

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET A$

LET L6

LET L7

IF ABS

LET A $

PRINT

=6. 25/2. 5E-4

=(6.25/2.5E-4)-25000

( J 5) <=1E-1 THEN 1390

- "6.25

/

2.5E-4

25000 ",I4,J5;A$

=. 1728/12E12

=(. 1728/1 2E12)-1.44000E-14

(L5) <=1E-19 THEN 1480

M .1728

" / 1 . 44000E-14 ",K4,L5;A$

" 12E12

=-l . 25E-10/6 25E16

=(-1.25E-10/625El6)-(-2.00000E-29)

(L6 ) <=lE-34 THEN 1570

= '»*» "-1.25E-10 "

" /

= " ,"-2. 00000E-29 " , K5, L6 ;A$

" 625E16

END TEST,

SECTION 25.3"

INVOLUTION'

" BEGIN TEST."

" IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

"SIX PLACE ACCURACY."

" BASE " " " ", "REQUIRED" , "POWER OF" , "ABSOLUTE"

"EXPONENT"," POWER "," SYSTEM "

, " ERROR "

= 144" . 5 =(144*. 5) -12

( L7 ) <=1E -4 THEN 1880

_ n * n "14 4
1890 PRINT " = 12 " ,L6,L7 ;A$

1900 PRINT " .

5

II 1910 PRINT

1920 LET A$=" " 1930 LET M6 = 5" (-. 004E3)

1940 LET M7= (5" (-. 004E3) ) -1 . 6E-3

1950 IF ABS (M7) < = 1 E -

6

THEN 1970

1960 LET A $ = " *

1970 PRINT " 5 1980 PRINT " = *'/• .0016 "

, M6 , M7 ; A$

1990 PRINT "-.004E3 If 2000 PRINT

2010 LET A$=" " 2020 LET L8=65536" (-625E-4)

2030 LET M8= (65536" (- 625E-4) ) -5E-1

2040 IF ABS (M8 ) <=lE-6 THEN 2060

2050 LET A $ = " *

2060 PRINT " 65536 II 2070 PRINT " .5 " ,L8,M8 ; A$

2080 PRINT "-625E-4 H 2090 PRINT

2100 LET A$= B " 2110 LET L9=. 03125" (- . 0002E3)

2120 LET M9= (.03125"

(

- . 0002E3) ) -2

2130 IF ABS (M9 ) <=lE-5 THEN 2150

2140 LET A $ = " * " 2150 PRINT " .03125 n 2160 PRINT " = 2 "

, L 9 , M 9 ; A $

2170 PRINT 0002E3 n 2180 PRINT

2190 LET A$ = " " 2200 LET N6=l . 2"5000E -3

2210 LET N7=(l. 2"5000E-3)-2. 48832

2220 IF ABS (N7) <=lE-5 THEN 2240

2230 LET A $ = " *

2240 PRINT " 1.2 II 2250 PRINT M = 2.48832 ", N6,N**;A$

2260 PRINT " 5000E-3 n 2270 PRINT

2280 LET A$=" " 2290 LET N8=l . 024E13" (-10E-2

)

2300 LET N9= (1. 024E13 " (-10E-2 )

) -5E-2

2310 IF ABS ( N 9 ) < = lE-6 THEN 2330

2320 LET A$=" *

2330 PRINT " 1.024E13 n 2340 PRINT M = .05 ",N8,N9;AS

2350 PRINT " -10E-2 rt 2360 PRINT

2370 PRINT " END TEST.

2380 PRINT

2390 PRINT

2400 END
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 25

BEGIN TEST.

SECTION 25.1

XXXXXXXXXXXXXXXXXX

X MULTIPLICATION X

XXXXXXXXXXXXXXXXXX

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

1ST. FACTOR

* REQUIRED PRODUCT OF ABSOLUTE

2ND. FACTOR PRODUCT SYSTEM ERROR

5

* = 6.25 6.25 0 1.25

21

* = -999999 -999999 0 -. 47619E5

-99

* = 909909 909909 0 -91 9100E-2

. 0015

* = 93.75 93.75 0 6. 25E4

1.92

* — 1.23456 1.23456 0 6430E-4

10. 631E27

* = -7. 65432E37 -7. 65432E+37 0 -72000E5

END TEST.

ILL
BEGIN TEST

SECTION 25.2

////////////

/ DIVISION /

////////////

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, CHECK TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

DIVIDEND

/

DIVISOR

REQUIRED

QUOTIENT

QUOTIENT OF

SYSTEM

ABSOLUTE

ERROR

625

/

1.25

= 500 500 0

84.876E7

/

-<>87 5 = -123456 -123456 0

-198765

/

-5E-20

= 3.97530E24 3. 97530E+24 0

6.25

/

2. 5E-4

= 25000 25000 0

. 1728

/

12E12

= 1. 44000E-14 1 . 44000E-14 0

-1. 25E-10

/

625E16

= -2. 00000E-29 -2 . 00000E-29 0

END TEST.

SECTION 25.3

INVOLUTION'

BEGIN TEST
IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

BASE

REQUIRED POWER OF ABSOLUTE

EXPONENT

144

POWER SYSTEM ERROR

. 5

5

12 12 0

-. 004E3

65536

.0016 . 0016 0

-625E-4

. 03125

. 5 . 5 0

-.0002E3

1.2

2 2 0

5000E-3

1. 024E13

2.48832 2.48832 0

-10E-2

— . 05 . 05 0

END TEST.

lit 6
I

26.0

ELEMENTARY OPERATIONS ON VARIABLES ASSIGNED

MIXED TYPE CONSTANTS

The objective of these tests is to verify further that numerical

expressions can be constructed by mixing simple numeric variables that have

not been assigned the same type of numeric constant, with the operations of

addition subtraction, multiplication, division, and involution.

26.1

Addition

The objective of this test is to verify that the operation of addition

of two numerically assigned simple variables, that have not been assigned the

same type of numeric constants, maintains at least six decimal digits of

precision. The test is similar in structure and output format to test 22.1.

26.2

Subtraction

The objective of this test is to verify that the operation of

subtraction between two numerically assigned simple variables, that have not

been assigned the same type constants, maintains at least six decimal digits

of precision. The test is similar in structure and output format to test

22 . 2 .

*******************

* PROGRAM FILE 26 * *******************

0010

0060

0070

0080

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

"PROGRAM FILE 26"

BEGIN TEST."

SECTION 26.1"

+ ADDITION +

"

" IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

"SIX PLACE ACCURACY."

lU?
«

0280 PRINT

0290 PRINT

0300 PRINT "ASSIGNMENT 1"

0310 PRINT " + "

, "REQUIRED" , "SUM OF" , "ABSOLUTE"

0320 PRINT "ASSIGNMENT 2"," SUM "/'SYSTEM"," ERROR " 0330 PRINT

0340 LET A$ = " " 0350 LET K=1

2

0360 LET K0=2 .

5

0370 LET Kl=-14 .

5

0380 LET K2=K+K

0

0390 LET K3=K2+K1

0400 IF ABS (K3 ) <=lE-3 THEN 420

0410 LET A $ = " *

0420 PRINT " 12

0430 PRINT " + = "," 14.5 " , K2 , K3 ; A $

0440 PRINT " 2.5 II 0450 PRINT

0460 LET A $= " " 0470 LET L=14

0480 LET M0=12 . 5E-3

0490 LET Nl=-. 140125E2

0500 LET O2=L+M0

0510 LET P3=02+Nl

0520 IF ABS (P3) <=lE-4 THEN 540

0530 LET A$=" *

0540 PRINT " 14 M 0550 PRINT " + ="," 14.0125 ",02,P3;A$

0560 PRINT " 12.5E-3 If 0570 PRINT

0580 LET A$ = " " 0590 LET A5=-9

0600 LET B 5=-l 5E-4

0610 LET C 5 = 9 . 001

5

0620 LET D5=A 5+B 5 0630 LET E 5=D 5+C 5 0640 IF ABS (E5) <=lE-5 THEN 660

0650 LET A$=" *

0660 PRINT ° -9 N 0670 PRINT " + =","-9.0015 ",D5,E5;A$

0680 PRINT "-15E-4 H 0690 PRINT

0700 LET A$=" " 0710 LET F5=. 625

0720 LET E6=- . 00005E7

0730 LET D7=499. 375

0740 LET C 8=F 5+E6

0750 LET B9=C8+D7

0760 IF ABS (B9) <=lE-3 THEN 780

0770 LET A$=" *

0780 PRINT " .625 II 0790 PRINT " + =","-499.375 ",C8,B9;A$

0800 PRINT . 000 5E

7

N 0810 PRINT

0820 LET A$=" " 0830 LET A4=1234 .

2

0840 LET A6=36000E-5

1U8
085k)

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1205

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

LET A7=-1234 . 56

LET A 8 =A 4 +A 6 LET A9=A8+A7

IF ABS (A9) < = lE-2 THEN 900

LET A $ = " *

PRINT " 1234.2

PRINT M + = 1234.56 ",A8,A9;A$

PRINT " 36000E-5

PRINT

LET A$=" " LET C9=65. 4321E21

LET D9 = l 234 5E17

LET E9=-6. 66666E22

LET F9=C9+D9

LET G9=F9+E9

IF ABS (G9 ) <=1E17 THEN 1020

LET A$

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET A$

LET H7

" 65. 4321E21 "

" + 6. 6666 6E 22 ",F9,G9;AS

" 12345E17

END TEST."

BEGIN TEST."

SECTION 26.2"

- SUBTRACTION

" IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

"SIX PLACE ACCURACY."

"ASSIGNMENT 1","

" - "," REQUIRED

"ASSIGNMENT 2" , "DIFFERENCE

= 2

II II 9

•• II 9

II II

DIFFERENCE"

OF "

, "ABSOLUTE"

SYSTEM "," ERROR "

LET H8=. 76544

LET 18=1.23456

LET H9=H’7 -H

8

LET 1 9=H 9-1

IF ABS (19) <=lE-5 THEN 1370

LET A $ = " * " PRINT " 2 PRINT " - ="," 1.23456 ",H9,I9;A$

PRINT " .76544

PRINT

149
1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

LET A$=" n LET A0=15

LET Al=- . 00520E3

LET Bl = . 202E2

LET A2=A0-Al

LET B2=A2-B1

IF ABS (B2) <=lE-4 THEN 1490

LET A$="*"

PRINT " 15

PRINT " - 20.2 ",A2,B2;A$

PRINT n - . 00 5 20E

3

PRINT

LET A$ = " " LET C 2=-9

LET A3 = 87 600E-5

LET B3=-9876E-3

LET H 4 =C 2 -A

3

LET B4=H4-B3

IF ABS ( B4 ) <=lE-5 THEN 1610

LET A$=" *

PRINT " -9

PRINT " PRINT M 87600E-5

PRINT

LET A$=" " LET C=8 .

8

LET C3=. 000231E6

LET D3=-222 .

2

LET C 4 =C -C 3 LET D4=C4-D3

IF ABS (D4) <=lE-3 THEN

LET A$=" *

PRINT " 8.8

PRINT " - =" PRINT " . 000231E6

PRINT

LET A$=" " LET B6=177 . 177

LET C6=54 0540E-4

LET B7=123.123

LET C7=B6-C6

LET B8=C7-B7

IF ABS ( B 8 ) < = lE-3 THEN

LET A $ = " * H PRINT " 177.177

PRINT " PRINT " 540540E-4

PRINT

LET A$ = " " LET E=-90. 1233E20

LET F=-12345E16

LET E0=-8.88888E21

LET F0=E-F

LET F1=F0-E0

IF ABS (FI) <=1E16 THEN

LET A

$= " *

PRINT "-90. 1233E20 "

"-9.876 " ,H4,B4;A$

1730

-222.2 ",C4,D4;A$

850

123.123 "

, C 7 , B 8 ; A $

970

150
1980 PRINT " = -8.8888 8E21 ",F0,F1;A$

1990 PRINT " -12345E16 II 2000 PRINT

2010 PRINT M END TEST

2020 PRINT

2030 PRINT

2040 END

kicic’kific-k-kicic’kicicit-k-kif * SAMPLE OUTPUT *

PROGRAM FILE 26

BEGIN TEST.

SECTION 26.1

+ ADDITION +

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 + REQUIRED SUM OF ABSOLUTE

ASSIGNMENT 2 SUM SYSTEM ERROR

12

+ 2.5

14.5 14.5 0

14

+ 12. 5E-3

14.0125 14.0125 0

-9

+ -15E-4

-9.0015 -9.0015 0

. 625

151
-499.375 -499.375 0

*4" -. 0005E7

1234.2

+ = 1234.56 1234.56 0 36000E-5

65 „ 4321E21

+ = 6.66666E22 6.66666E+22 0 12345E17

END TEST.

BEGIN TEST.

SECTION 26.2

- SUBTRACTION -

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS A VALUE IN THE ABSOLUTE

ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 REQUIRED

DIFFERENCE

OF ABSOLUTE

ASSIGNMENT 2 DIFFERENCE SYSTEM ERROR

2 1.23456 1.23456 0

. 76544

15

20.2 20.2 0 -. 00520E3

-9

-9.876 -9.876 0 87600E-5

8.8

-222.2 -222.2 0

. 000231E6

177.177

123.123 123.123 0 540540E-4

-90. 1233E20

-8. 88888E21 -8. 88888E+21 0

152
-12345E16

END TEST.

153
27.0

ELEMENTARY OPERATIONS ON VARIABLES ASSIGNED

MIXED TYPE CONSTANTS (CONTINUED)

27.1

Multiplication

The objective of this test is to verify that the operation of

multiplication of two numerically assigned simple variables, which have not

been assigned the same type constants, will maintain at least six decimal

digits of precision. This test is similar in structure and output format to

test 23.1.

27.2

Division

The objective of this test is to verify that the operation of division

between two numerically assigned simple variables, which have not been

assigned the same type numeric constants, will maintain at least six decimal

digits of precision. The test is similar in structure and output format to

test 23.2.

27.3

Involution

The objective of this test is to verify that the operation of involution

of two numerically assigned simple variables, which have not been assigned

the same type constants, will maintain at least six decimal digits of

precision. The test is similar in structure and output format to test 23.3.

*******************

* PROGRAM FILE 27 * *******************

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

"PROGRAM

II

FILE 27 «

BEGIN TEST."

SECTION 2 7 . 1

XXXXXXXXXXXXXXXXXX"

X MULTIPLICATION X"

XXXXXXXXXXXXXXXXXX"
0170

0180

0190

0200

0210

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

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

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR”

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " * "

, "REQUIRED" , "PRODUCT OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2", "PRODUCT SYSTEM "," ERROR " PRINT

LET A$=" " LET G=5

LET H=1 . 25

LET 1=6.25

LET J=G *H

LET G0=J-I

IF ABS (G 0 ) < = lE-5 THEN 370

LET A $ = " *

PRINT " 5 PRINT " * ="," 6.25 ",J,G0;A$

PRINT "1.25

PRINT

LET A$ = " " LET H0=21

LET 10=-. 47619E5

LET J0=-999999

LET G1=H0 *1

0

LET H 1=G 1-J 0 IF ABS (HI) < = 1E 0 THEN 490

LET A$=" *

PRINT " 21

PRINT " * =","-999999 ",G1,H1;A$

PRINT " - . 4 7 6 1 9E

5

PRINT

LET A$=" " LET 1 1 = -9 9 LET Jl=-91 91 00E-2

LET H2=909909

LET I 2=1 1*J 1 LET J2 = I 2-H 2 IF ABS ( J 2 ) < = 1E 0 THEN 610

LET A $ = " * " PRINT " -99

PRINT " * ="," 909909 ",I2,J2;A$

PRINT "-919100E-2 " PRINT

LET A$=" " LET I 3=. 0015

LET J3=6. 25E4

LET J4=93 . 75

LET L0=I 3*J3

LET L1=L0-J

4

IF ABS (LI) <=lE-4 THEN 730

LET A$= " *

PRINT " .0015

155
0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

124 0 1250

1260

1270

1280

1290

1300

PRINT " * = "," 93.75 ",L0,L1;A$

PRINT " 6.25E4 " PRINT

LET A$ = " " LET Ml=l . 92

LET L2=6430E-4

LET M2=l. 23456

LET N 2=M 1 *L2

LET L3=N2-M2

IF ABS (L3) <=lE-5 THEN 850

LET A $ = " *

PRINT " 1.92

PRINT " * = 1.23456 ",N2,L3;A$

PRINT " 6430E-4

PRINT

LET A$=" " LET M3=i0 . 631E27

LET N3=-72000E5

LET L4=-7. 6543 2E 37

LET M4=M3*N3

LET N4=M4-L4

IF ABS (N4) <=1E32 THEN 970

LET A $ = " * " PRINT " 1 0 . 6 3 IE 27 " PRINT " * = "

, "-7. 65432E37 ",M4,N4;A$

PRINT "-72000E5

PRINT

PRINT " END TEST.

PRINT

PRINT

PRINT

PRINT M BEGIN TEST."

PRINT

PRINT

PRINT " • SECTION 27.2"

PRINT

PRINT " ////////////"

PRINT " / DIVISION /"

PRINT " ////////////"

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " /

", "REQUIRED" , "QUOTIENT OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2" , "QUOTIENT" , " SYSTEM "

, " ERROR " PRINT

LET A$ = " " LET 03=625

LET 04=1.25

LET M5=500

LET N 5=0 3/04

LET 0 5=N 5-M 5

156
1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

IF ABS (05) <=lE-3 THEN 1330

LET A $ = " *

PRINT " 625

PRINT " /

PRINT " 1.25

PRINT

LET A$=" " LET Q4=84 . 876E7

LET R5=-6875

LET S6=-l 234 56

LET T7=Q4/R5

LET U 8=T7-S

6

IF ABS (U 8 ) < = 1E 0 THEN 1450

LET A $ = " *

PRINT " 84.876E7 " PRINT " /

PRINT " -6875

PRINT

LET A$=" " LET P4=-198765

LET P5=-5E-20

LET Q5=39753E20

LET J6=P4/P5

LET K6=J 6-Q5

IF ABS (K6) <=1E19 THEN 1570

LET A $ = " *

PRINT "-198765

PRINT " /

PRINT " -5E-20

PRINT

LET A$=" " LET T=6 . 25

LET T0=2 . 5E-4

LET Tl=25000 .

0

LET T2=T/T0

LET T 3 =T 2 -T

1

IF ABS (T3) <=1E-1 THEN 1690

LET A $ = " *

PRINT " 6.25

PRINT " /

PRINT " 2.5E-4

PRINT

LET A$=" " LET M=. 1728

500 "

, N 5 , 0 5 ; A $

”,"-123456 ",T7,U8;A$

3 . 9‘

7 53E24 ",J6,K6;A$

25000 ",T2,T3;A$

LET N=12E12

LET O=144000E-19

LET P=M/N

LET Q=P-0

IF ABS (Q) <=1E-19 THEN 1810

LET A $ = ” *

PRINT " .1728

PRINT " / 1 . 44000E-14 ",P,Q;A$

PRINT " 12E12

PRINT

LET A$= " " LET R=-l . 25E-10

LET S=625E16

157
1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

1980

1990

2000

2010

2020

2030

2033

2035

2040

2050

2060

2070

2080

2090

2100

2110

2120

2130

2140

2150

2160

2170

2180

2190

2200

2210

2220

2230

2240

2250

2260

2270

2280

2290

2300

2310

2320

2330

2340

2350

2360

2370

2380

2390

2400

2410

2420

LET N0=-2. 00000E-29

LET O0=R/S

LET P0=O0-N0

IF ABS (P0) <=1E~34 THEN 1930

LET A $ = " *

PRINT "-1 . 25E-10

PRINT " /

=" ,"-2. 00000E-29 " , 00 , P0 ; A $

PRINT " 625E16

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " SECTION 27.3"

PRINT

PRINT " " PRINT " "INVOLUTION""

PRINT " " PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " " "/’REQUIRED" , "POWER OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2"," POWER "," SYSTEM "

, " ERROR " PRINT

LET A$=" " LET N 0 = 1 4 4 LET 00=.

5

LET P0=1

2

LET Q0=N 0 "00

LET R0=Q0-P0

IF ABS (R0 ) <=lE-4 THEN 2270

LET A $ = " *

PRINT "144

PRINT " " ="," 12 " , Q0 , R0 ; A $

PRINT " .5

PRINT

LET A $ = " " LET 01=5

LET Pl=- . 004E3

LET Ql=l . 6E-3

LET Rl=01"Pl

LET S1=R1-Q1

IF ABS (SI) <=lE-6 THEN 2390

LET A $ = " *

PRINT " 5 PRINT " " ="," .0016 " ,R1,S1;A$

PRINT " - . 0 0 4 E 3 PRINT

158
2-130 LET A$=" " 2 110 LET U=65536

2-150 LET V=-625E-4

2 1 S3 LET W=5E-1

2 1 7 3 j3T X=U~V

2 133 jST y=x-w

24 90 IF ABS ( Y ) <=lE-6 THEN 2510

2 >10 LET A$=" *

2510 PRINT " 65536

2520 PRINT " * .5 "

, X, Y ; A$

2530 PRINT "-625E-4

2. >40 PRINT

2 : > > 0 jET A$=" "

2:. >0 jLT R=. 03125

2570 LET S=- . 0002E3

2530 LET Z=2

2.390 jET R0=R~S

25)0 jET S0=R0-Z

2510 IF ABS (S0) <=lE-5 THEN 2630

2520 LET A $ = " *

2530 >RINT " .03125

2(.40 >11 NT " * = M ," 2 ",R0,S0;A$

2<. >!) MIN' 1 0002E3

2550 >RINT

2570 !jET A$= " " 2530 LET U0=1 .

2

2( 50 jET V0=5000E-3

2' 00 LET W0=2. 48832

2710 LET X0=U0~V0

2

' 20 LET Y0=X0 -W0

2' 30 IF ABS (Y 0) < = lE-5 THEN 2750

2" < 0 LET A$= " *

2' 50 PRINT " 1.2 ' 2' 50 PRINT " ~ 2.48832 " , X0 , Y0 ; A$

2770 PRINT n 5000E-3

2' 80 PRINT

2 90 LET A$=" " 2i 00 LET Ul=l . 024E13

21 10 LET Vl=-1 0E-2

2) 20 LET Wl=5E-2

21 30 LET X1=U1"V1

2f ' 0 LET Yl=Xl-W

1

21 E £ IF ABS (Yl) <=lE-6 THEN 2870

25 60 LET A $ = " * 11 28 70 PRINT M 1.024E13 " 2f f 0 PRINT " “ .05 M ,Xl,Yl;A$

2190 PRINT " -10E-2

2S 00 PRINT

2S10 PRINT " END TEST

21 20 PRINT

2? : 0 PRINT

21 4 0 END

159
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 27

BEGIN TEST.

SECTION 27.1

XXXXXXXXXXXXXXXXXX

X MULTIPLICATION X

XXXXXXXXXXXXXXXXXX

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 * REQUIRED PRODUCT OF ABSOLUTE

ASSIGNMENT

5

2 PRODUCT SYSTEM ERROR

* 1.25

21

6.25 6.25 0

* -. 47619E5

-99

-999999 -999999 0

* -919100E-2

. 0015

909909 909909 0

* 6. 25E4

1.92

93.75 93.75 0

* 6430E-4

10.631E27

1. 23456 1.23456 0

* -72000E5

= -7. 65432E37 -7. 65432E+37 0

END TEST.

160
BEGIN TEST

SECTION 27.2

////////////

/ DIVISION /

////////////

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 /

ASSIGNMENT 2 REQUIREDQUOTIENT

QUOTIENT OF

SYSTEM

ABSOLUTE

ERROR

625

/

1.25

500 500 0

84.876E7

/

-6875

-123456 -123456 0

-198765

/

-5E-20

3. 9753E24 3.97530E+24 0

6.25

/

2. 5E-4

25000 25000 0

. 1728

/

12E12

1. 44000E-14 1. 44000E-14 0

-1. 25E-10

/

625E16

-2. 00000E-29 -2. 00000E-29 0

END TEST.

SECTION 27.3

'“INVOLUTION"

BEGIN TEST.

l6l
IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 REQUIRED POWER OF ABSOLUTE

ASSIGNMENT 2 POWER SYSTEM ERROR

144

A 12 12 0

. 5

5

A

. 0016 . 0016 0 004E3

65536

. 5 . 5 0 -625E-4

.03125

2 2 0 -. 0002E3

1. 2 2.48832 2.48832 0 5000E-3

1. 024E13

. 05 .05 0 -10E-2

END TEST.

162
28.0

ADDITION OF THREE OR MORE TERMS

The objective of this section is to verify that three or more terms can

be used in the construction of numerical expressions using the operation of

addition.

28.1

Using only Numerical Constants

The

of three

digits of

constants

first col

" Requ i red

column is

the numbe

second co sums of

fourth co and the

least six

such case

objective of this test is to verify that the operation of addition

or more numerical constants will maintain at least six decimal

precision. The test forms the sum of three or more numerical

of different type. There are four columns of output of which the umn is labeled "Number of Terms," the second column is labeled

Sum," the third column is labeled "Sum of System," and the fourth

labeled "Absolute Error." The first column lists numbers indicating

r of terms that should have been summed for each row of output; the

lumn lists a standard conforming output; the third column lists the

the constants as evaluated by the system being tested; and the

lumn contains lists of the differences between the expected values

system generated values. If the implementation did not maintain at

decimal digits of precision, an asterisk will appear beside any

28.2

Using only Numerically Assigned Variables

The objective of this test is to verify that the operation of addition

of three or more numerically assigned simple variables will maintain at least

six decimal digits pf precision. The test is similar to 28.1, except for the

use of simple variables. The test has the same output format as test 28.1.

28.3

Numerical Constants and Assigned Variables, Mixed

The objective of this test is to

both numerical constants and simple va operation of addition of several terms

and simple variables will maintain at

The test is similar, both in structure

construct numerica

riables together,

composed of both

least six decimal

and output to tes

1 expressions

It verifies tha

numerical cons digits of preci

t 28.1.

using

t the

tants

sion.

•kfc-k-k'k’k^citic'kic’k-k'k-k'kic'k'k * PROGRAM FILE 28 *

0010 PRINT "PROGRAM FILE 28"

0060 PRINT

0070 PRINT

163
0080

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

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0 60 0 0610

0620

0630

0640

PRINT

PRINT " SECTION 28.0: ADDITION OF THREE OR MORE TERMS."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "NUMBER OF" , "REQUIRED" , "SUM OF" , "ABSOLUTE"

PRINT " TERMS "," SUM ", "SYSTEM"," ERROR ” PRINT n ************************************************** M « PRINT 11 ******** * ******* * * •* PRINT

PRINT

PRINT ” SECTION 28.1"

PRINT

PRINT " (USING ONLY NUMERICAL CONSTANTS.)"

PRINT

PRINT

LET A $ = " " LET A=12+56+92

LET Al= (12+56+92) + (-160)

IF ABS (Al) <=lE-3 THEN 380

LET A $ = " *

PRINT " 3 "," 160 " , A, Al ; A$

LET A$=" " LET B=4.9+95+9E2+9.9E-2

LET Bl= (4 . 9+95+9E2+9. 9E-2) + (-999.999)

IF ABS (Bl) < = lE-3 THEN 440

LET A$=" *

PRINT " 4 "," 999.999 ",B,Bl;A$

PRINT

PRINT

PRINT "ft*************************************************”.

PRINT "**********************"

PRINT

PRINT

PRINT " SECTION 28.2"

PRINT

PRINT " (USING ONLY NUMERICALLY ASSIGNED VARIABLES.)"

PRINT

PRINT

LET A$=" " LET A 2 = 2 .

4

LET A3=23 . 05

LET A4=230 . 004

LET A5 = 4 3 2 .

1

LET A6=300.

1

LET A7=314

LET A8 = 8 4E-2

LET A9= . 5E-2

16U
0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

LET A0=-987 . 654

LET C =A 2 +A 3 +A 4 +A 5 +A 6 LET C 1=C+A0

IF ABS (Cl) <=1E J3 THEN 700

LET A$=" *

PRINT " 5 987.654 ",C,C1;A$

LET A$=" " LET B2=-999. 999

LET B 3 =A 3 +A 4 +A 5 +A 7 +A 8 +A 9 LET B4=B3+B2

IF ABS (B4 ) <=lE-3 THEN 770

LET A $ = " *

PRINT " 6 999.999 ",B3,B4;A$

PRINT

PRINT

PRINT 11 ************************************************** n • PRINT “fr***********************

PRINT

PRINT

PRINT " SECTION 28.3"

PRINT

PRINT " (NUMERICAL CONS. AND ASSIGNED NUMERICAL VARS., MIXED.)"

PRINT

PRINT

LET A$=" " LET C2=110000

LET C3=10.1E7

LET C4=7 . 4E8

LET C5=8E9

LET C 6=1 . 6E32

LET C7=l. 2E34

LET C8=l . 0E36

LET D1=C6+1. 3E33+C7+100. 1E33+100. 0E33+C8+2. 1E34

LET D2=Dl+(-l. 23456E36)

IF ABS (D2) <=1E31 THEN 1010

LET A$=" *

PRINT " 7 1.23456E36 ",Dl,D2;A$

LET A$ = " " LET D3=80000. 0+C2+58E5+C3+5. 3E7+C4+1. 1E9+C5

LET D4=D3+ (-9. 99999E9)

IF ABS (D4) <=1E4 THEN 1070

LET A $ = " * " PRINT " 8 9.99999E9 ",D3,D4;A$

PRINT

PRINT

PRINT 11 **************************************************** • PRINT "fr***********************

PRINT

PRINT " END TEST."

PRINT

PRINT

END

165
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 28

SECTION 28.0: ADDITION OF THREE OR MORE TERMS.

BEGIN TEST.

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

NUMBER OF REQUIRED SUM OF ABSOLUTE

TERMS SUM SYSTEM ERROR ************************************************************************

SECTION 28.1

(USING ONLY NUMERICAL CONSTANTS.)

3 160 160 0

4 999.999 999.999 0

************************************************************************

SECTION 28.2

(USING ONLY NUMERICALLY ASSIGNED VARIABLES.)

5 987.654 987.654 0

6 999.999 999.999 0

************************************************************************

SECTION 28.3

(NUMERICAL CONS. AND ASSIGNED NUMERICAL VARS., MIXED.)

166
7

8 1. 23456E369. 99999E9

1. 23456E+36

9. 99999E+9

0

0

ft****************************************** *****************************

END TEST.

167
29.0

MULTIPLICATION OF THREE OR MORE FACTORS

The purpose of this section is to show that three or more factors can be

used in the construction of numerical expressions using the operation of

multiplication.

29.1

Using Numerical Constants Only

The objective of this test is to verify that the operation of

multiplication of three or more numerical constants will maintain at least

six decimal digits of precision. The test forms the products of three or more factors of different types. There are four columns of output, of which

the first column is labeled "Number of Terms", the second column is labeled

"Required Product", the third column is labeled "Product of System", and the

fourth column is labeled "Absolute Error". The first column lists the number

of factors that should have been multiplied for each row, the second column

lists the standard conforming expected output, the third column lists the

products of the constants as evaluated by the system being tested, and the

fourth column lists the difference between the expected values and the system

generated values. If the implementation did not maintain at least six

decimal digits of precision, an asterisk will appear beside any such case.

29.2

Using Only Assigned Variables

The objective of this test is to verify that the operation of

multiplication of three or more numerically assigned simple variables will

maintain at least six decimal digits of precision. The test is similar both

in structure and output format to test 29.1.

29.3

Numerical Constants and Assigned

Numerical Variables, Mixed

The objective of this test

multiplication upon several numer maintain at least six decimal digits

structure and output to test 29.1.

is to verify

ical constants

of precision.

that the

and simple

The test

operation of

variables will

s similar in

*******************

* PROGRAM FILE 29 * *******************

0010 PRINT "PROGRAM FILE 29"

0060 PRINT

0070 PRINT

0080 PRINT

168
0 0 9 0

0101

011 !) 012 !) 0131)

0141)

0150

0160

0170

0180

0190

0200

0210

0220

023 ) 024 ) 0250

0 260

0270

0280

0290

0300

0310

0 320

0 3 30

0340

035i)

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0 520

0530

0540

0550

0561)

0570

0580

0590

0600

0610

0620

0630

0640

0650

PRINT “ SECTION 29.0: MULTIPLICATION OF THREE OR MORE FACTORS.”

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "NUMBER OF" , "REQUIRED" , "PRODUCT OF" , "ABSOLUTE"

PRINT " TERMS ", "PRODUCT "," SYSTEM "," ERROR " PRINT 11 **************************************************** • PRI NT " ************************ PRINT

PRINT

PRINT " SECTION 29.1"

PRINT

PRINT " (USING ONLY NUMERICAL CONSTANTS.)"

PRINT

PRINT

LET A$=" " LET Z0=2*4*8179

LET Zl= (2*4*8179) +(-65432)

IF ABS (Zl) <=1E-1 THEN 380

LET A $ = " *

PRINT " 3 "," 65432 ",Z0,Z1;A$

LET A$=“ " LET P2=3*.1*9E~4*3. 7037E24

LET Q2= (3*. l*9E-4*3. 7037E24) + (-9 . 99999E20

)

IF ABS (Q2 ) <=1E16 THEN 440

LET A$=" *

PRINT " 4 "," 9.99999E20 ",P2,Q2;A$

PRINT

PRINT

PRINT 11 ***************** a******************************** 11 • PRINT " **********************"

PRINT

PRINT

PRINT " SECTION 29.2"

PRINT

PRINT " (USING ONLY NUMERICALLY ASSIGNED VARIABLES.)"

PRINT

PRINT

LET A$=" " LET R2=l .

5

LET S2=0 .

2

LET U2=3 .

7

LET V2=2 .

0

LET W2=2. 557

LET X2=3367

LET Y2=3E-11

LET Z 2 = . 14

LET X3=. 35E34

169
0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

LET Y3=2E-11

LET Z 3 = . 1 LET Q3=-5. 67654

LET R3=-9. 89898E13

LET U3=R2*S2*U2*V2*W2

LET V3=U 3+Q3

IF ABS ( V 3 ) < = lE-5 THEN 740

LET A $="*"

PRINT " 5 5.67654 ",U3,V3;A$

LET A$= H " LET S3=X2*Y2*Z2*X3*Y3*Z3

LET W3=S3+R3

IF ABS ( W3 ) < = 1E 8 THEN 800

LET A $ = " *

PRINT " 6 9.89898E13 ",S3,W3;A$

PRINT

PRINT

PRINT ” . PRINT "^t**********************

PRINT

PRINT

PRINT " SECTION 29.3"

PRINT

PRINT " (NUMERICAL CONS. AND ASSIGNED NUMERICAL VARS., MIXED.)"

PRINT

PRINT

LET A$ = " " LET X2=l . 5E-5

LET Y2=0 . 8E20

LET Z 2 = 64 . 3E8

LET X3=2 . 0E-6

LET Y3=3

LET Z 3=6 . 25

LET Q3=10101

LET R3 = l . 1 LET U3=X2*.2E8*Y2*.4E-10*Z2*.1E-5*X3

LET V3=U3+(-l. 23456E10)

IF ABS ( V 3 ) < = 1E5 THEN 1050

LET A

$= " *

PRINT " 7 1.23456E10 ",U3,V3;A$

LET A$=" " LET S 3=37 5E10*Y 3*1. 6E-1 2 *Z 3 * 4E 2 1 *Q3* . 2E-10*R3

LET W3=S3+(-9. 99999E16)

IF ABS (W3) <=1E11 THEN 1110

LET A$=" *

PRINT " 8 9.99999E16 ",S3,W3;A$

PRINT

PRINT

PRINT "**************************************************"•

PRINT "*********************"

PRINT

PRINT " END TEST."

PRINT

PRINT

END

170
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 29

SECTION 29.0: MULTIPLICATION OF THREE OR MORE FACTORS.

BEGIN TEST.

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

NUMBER OF REQUIRED PRODUCT OF ABSOLUTE

TERMS PRODUCT SYSTEM ERROR ************************************************************************

SECTION 29.1

(USING ONLY NUMERICAL CONSTANTS.)

3 65432 65432 0

4 9.99999E20 9.99999E+20 0

************************************************************************

SECTION 29.2

(USING ONLY NUMERICALLY ASSIGNED VARIABLES.)

5 5.67654 5.67654 0 6 9.89898E13 9.89898E+13 0

************************************************************************

SECTION 29.3

(NUMERICAL CONS. AND ASSIGNED NUMERICAL VARS., MIXED.)

171
7

8 1. 23456E10 1 . 234 56E + 10 09 . 99999E16 9.99999E+16 0

************************************************************************

END TEST.

172
30.0

HIERARCHY OF OPERATIONS AND PARENTHESES

In this and the succeeding section we verify that for any numerical

expression, involutions are performed first, then multiplications and

divisions, and finally additions and subtractions (unless parentheses dictate

otherwise). Furthermore, in the absence of parentheses, and where it matters

mathematically, we determine whether any numerical expression, having

operations of the same precedence, is associated to the left. In this

section the tests will concentrate on evaluating expression formed from

constants. Variables will be introduced in section 31. The reader should be

familiar with the operator precedence specifications in section 7.4 of BSR

X3. 60.

30.1

Expressions with Operators of Equal Priority

The objective of this test is to verify that in numerical expressions,

in which there are no parentheses ordering operations, operators of the same precedence will associate to the left and maintain at least six decimal

digits of precision. The test uses only numerical constants in the

expressions and the operators of equal precedence are used in the following

order: (1) operators are all division symbols, (2) operators are all

subtraction symbols, (3) operators are all involution symbols, (4) operators

are both subtraction and addition symbols, and (5) operators are both

division and multiplication.

There are two , columns of output. The first column is labeled

"Operator (s) of Expression" and the second column is labeled "Evaluation of

System". The first column lists the operator (s) that are used in each

numeric expression tested, while the second column lists whether the

implementation passed or failed according to the expected values of this

test

.

30.2

Expressions with Operators of Different Priorities

and no Parenthesis

The objective of this test is to verify that in numerical expressions in

which there are no parentheses to dictate the order of operations, operators

of different precedence will be performed in the following sequence: first,

involutions, then multiplications and divisions, and finally, additions and

subtraction. The test also determines whether the expressions maintain at

least six decimal digits of precision. The expressions used have only

numerical constants in them. Only numerical expressions, in which there are operators of unequal precedence, in different combinations, for the different

numeric expressions, are used.

There are two columns of output. The first column is labeled "Priority

of Operator" and the second column is labeled "Evaluation of System". The

first column lists the operators and their priorities according to their

usage in each numeric expression to be tested, while the second column lists

whether the implementation passed or failed.

30.3

Expressions with Operators of Different Priorities

and Parentheses

173
The objective of this test is to verify that numerical expressions, with

parentheses to order the operations, will be evaluated properly and maintain

at least six decimal digits of precision. The test uses two approaches.

First, parentheses are used to alter the evaluation for numeric expressions

using operators of equal precedence. Then, parentheses are used to alter the

evaluation for numeric expressions using operators of unequal precedence.

There is a two column output of which the first column is labeled

"Alteration of Priority by Parentheses", and the second column is labeled

"Evaluation of System". The first column lists the classes of numeric

expressions which should have been evaluated, while the second column lists

whether implementation evaluated each class of expressions successf ullly or unsuccessfully

.

*******************

* PROGRAM FILE 30 * *******************

0 010 PRINT

0 060 PRINT

0 070 PRINT

0 080 PRINT

0 090 PRINT

0 100 PRINT

0 110 PRINT

0 120 PRINT

0 130 PRINT

0 140 PRINT

0 150 PRINT

0 160 PRINT

0170 PRINT

0 180 PRINT

0 190 PRINT

0 200 PRINT

0 210 PRINT

0 220 PRINT

0 230 PRINT

0 240 PRINT

0 250 PRINT

0 260 PRINT

0 270 PRINT

0 280 PRINT

0 290 PRINT

0 300 PRINT

0 310 PRINT

0 320 PRINT

0 330 PRINT

0 340 PRINT

0 350 PRINT

"PROGRAM FILE 30“

SECTION 30.0: HIERARCHY OF OPERATORS AND PARENTHESES."

" SINCE THIS TEST IS ONLY CONCERNED WITH THE ORDER OF"

"OPERATIONS, THE SELECTED NUMBERS USED FOR THIS TEST ARE IN"

"INTEGER FORM ONLY."

" SECTION 30.1"

" LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH OPERA-"

"TORS OF EQUAL PRIORITY, USING CONSTANTS ONLY."

"*****NOTE: LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH"

"OPERATORS OF ONLY ADDITION OR MULTIPLICATION DOES NOT " "APPLY, THEREFORE, SUCH EXPRESSIONS ARE NOT TESTED IN"

"THIS TEST . "

" BEGIN TEST."

TAB (18) ; "OPERATOR (S ) " ; TAB (40) ; "EVALUATION"

TAB (18);" OF " ; TAB ( 4 0 )

;

OF

TAB (18) ; "EXPRESSION ";TAB(40);" SYSTEM "

" ** ************************************************ *• .

9

174
0360

0370

0380

0390

0 4 0 0 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

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

PRINT *' a********************* 1 * PRINT

PRINT

LET A$="PASSED"

LET A=81/9/3

LET Al=A-3

IF ABS (Al) <=lE-5 THEN 440

LET A$=" FAILED"

PRINT TAB (18) ; "DIVISION" ; TAB (40) ;A$

PRINT

LET A$="PASSED"

LET A=23-13-2

LET Al=A-8

IF ABS (Al) <=lE-5 THEN 510

LET A$="FAILED"

PRINT TAB (18) ; "SUBTRACTION" ;TAB (40) ;A$

PRINT

LET A$="PASSED"

LET A=9~3~2

LET Al=A-531441

IF ABS (Al ) <=1E0 THEN 580

LET A$="FAILED"

PRINT TAB (18) ; "EXPONENTIATION" ;TAB (40) ;A$

PRINT

LET A$="PASSED"

LET A=23-13+2

LET A 1 =A - 1

2

IF ABS (A-12) <=lE-4 THEN 650

LET A$="FAILED"

PRINT TAB (18) ; "SUBTRACTION"

PRINT TAB (18) ; " 'AND ";TAB(40);A$

PRINT TAB (18);" ADDITION " PRINT

LET A$="PASSED"

LET A=81/9*3

LET Al=A-27

IF ABS (Al) <=1E~4 THEN 740

LET A$="FAILED"

PRINT TAB (18) ; " DIVISION

PRINT TAB (18) ; " AND ";TAB(40);A$

PRINT TAB (18) ; "MULTIPLICATION"

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT " SECTION 30.2"

PRINT

PRINT " EVALUATION OF THE PRECEDENCE OF OPERATORS FOR EXPRESPRINT "SIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES IN"

PRINT "THE ABSENCE OF PARENTHESES, USING CONSTANTS ONLY."

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT TAB (21) ; "PRIORITY" ;TAB (51) ; "EVALUATION"

PRINT TAB (24 ) ; "OF" ;TAB (55) ; "OF"

PRINT TAB (21) ; "OPERATOR" ; TAB (53) ; "SYSTEM"

175
0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

PRINT "**************************************************".

PRINT ************************** PRINT

PRINT

LET A$= M PASSED"

LET A=81+2*3-7+20

1220

BEFORE ADDITION OR SUBTRACTION FAILED.

LET A1=A-100

IF ABS (Al) <=lE-3 THEN 1020

LET A$=" FAILED"

PRINT TAB (18) ; "MULTIPLICATION"

PRINT TAB (22) ; "BEFORE" ;TAB (53) ;A$

PRINT TAB (11) ; "ADDITION OR SUBTRACTION"

PRINT

LET A$="PASSED"

LET A=100+72/9-3-6

LET Al=A-99

IF ABS (Al) <=lE-4 THEN 1110

LET A$="FAILED"

PRINT TAB (21) ; "DIVISION"

PRINT TAB (22) ; "BEFORE" ;TAB (53) ;A$

PRINT TAB (11) ; "ADDITION OR SUBTRACTION"

PRINT

LET A$="PASSED"

LET F=0

LET A = 10 + 100''2-ll

LET Al=A-9999

IF ABS (Al) <=lE-2 THEN

LET F=F+1

PRINT "EXPONENTIATION

LET A*ll*3~2/9

LET Al=A-ll

IF ABS (Al) <=lE-4 THEN

LET F=F+1

PRINT "EXPONENTIATION

LET A=-15~2

LET Al=A-(-225)

IF ABS (Al) <=lE-3 THEN

LET F=F+1

PRINT "EXPONENTIATION

IF F=0 THEN 1340

GOTO 1370

PRINT TAB (18) ; "EXPONENTIATION"

PRINT TAB (19); "AS FIRST OF " ; TAB ( 5 3 ) ; A

$

PRINT TAB (20) ; "OPERATIONS"

PRINT

PRINT " END TEST.

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT " BEGIN TEST.

1270

BEFORE MULTIPLICATION OR DIVISIONFAILED.

1320

BEFORE UNARY FAILED.

" SECTION 30.3"

" EVALUATION OF THE PRECEDENCE OF OPERATIONS FOR THOSE"

"EXPRESSIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES"

"BUT ARE INFLUENCED BY THE USE OF PARENTHESES, USING CON-"

"STANTS ONLY."

176
1500 PRINT

1510 PRINT TAB (14) ; "ALTERATION OF PRIORITY" ; TAB ( 5 1 );" EVALUATION"

1520 PRINT TAB (24) ; "BY" ;TAB (55) ; "OF"

1530 PRINT TAB (19) ; "PARENTHESES" ;TAB (53) ; "SYSTEM"

1540 PRINT ”************************************************** w • 1550 PRINT " *****************»

1560 PRINT

1570 PRINT

1580 LET F=0

1590 LET A=81/ (9/3

)

1600 LET A l=A-27

1610 IF ABS (Al) <=lE-4 THEN 1630

1620 LET F=1

1630 LET A=23-(13-2)

1640 LET A 1=A-1

2

1650 IF ABS (Al) <=lE-4 THEN 1670

1660 LET F=1

1670 LET A=4~(3~2)

1680 LET Al=A-262144

1690 IF ABS ( Al ) <=1E0 THEN 1710

1700 LET F=1

1710 LET A=23- (13+2)

1720 LET Al=A-8

1730 IF ABS (Al) <=lE-5 THEN 1750

1740 LET F=1

1750 LET A=81/ (9*3

)

1760 LET Al=A-3

1770 IF ABS (Al) <=lE-5 THEN 1790

1780 LET F=1

1790 IF F=0 THEN 1820 - 1800 LET A$=" UNSUCCESSFUL"

1810 GOTO 1830

1820 LET A $=" SUCCESSFUL"

1830 PRINT TAB (18) ; "EXPRESSIONS OF"

1840 PRINT TAB (18) ; "LEFT TO RIGHT" ; TAB ( 5 1 ) ; A

$

1850 PRINT TAB (20) ; "EVALUATION"

1860 PRINT

1870 LET F=0

1880 LET A= (81+2) * (3-7) +20

1890 LET Al=A-(-312)

1900 IF ABS (Al) <=lE-3 THEN 1920

1910 LET F=1

1920 LET A= (100+92) / ( 9- 3

) -6

1930 LET Al=A-26

1940 IF ABS (Al) <+lE-4 THEN 1960

1950 LET F=1

1960 LET A=(725+274)~ (4-2)+1998

1970 LET Al=A -999999

1980 IF ABS ( Al ) < = 1E 0 THEN 2000

1990 LET F=1

2000 LET A=(ll*3)~(9/3)/27

2010 LET Al=A-1331

2020 IF ABS (Al) <=lE-2 THEN 2040

2030 LET F=1

2040 LET A= (-15

) ~

2

2050 LET Al=A-22

5

2060 IF ABS (Al) <=lE-3 THEN 2080

177
2070 LET F = 1 2080 IF F=0 THEN 2110

2090 LET A $=" UNSUCCESSFUL"

2100 GOTO 2120

2110 LET A $=" SUCCESSFUL"

2120 PRINT TAB (14) ; "EXPRESSIONS EVALUATED"

2130 PRINT TAB (18); "BY PRIORITY OF " ; TAB ( 5 1 ) ; A

$

2140 PRINT TAB (19); "THE OPERATOR"

2150 PRINT

2160 PRINT " END TEST."

2170 PRINT

2180 END

ft****************

* SAMPLE OUTPUT

*

PROGRAM FILE 30

SECTION 30.0: HIERACHY OF OPERATORS AND PARENTHESES.

SINCE THIS TEST IS ONLY CONCERNED WITH THE ORDER OF

OPERATIONS, THE SELECTED NUMBERS USED FOR THIS TEST ARE IN

INTEGER FORM ONLY.

SECTION 30.1

LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH OPERATORS OF EQUAL PRIORITY, USING CONSTANTS ONLY.

* * * * *NOTE : LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH

OPERATORS OF ONLY ADDITION OR MULTIPLICATION DOES NOT

APPLY, THEREFORE, SUCH EXPRESSIONS ARE NOT TESTED IN

THIS TEST.*****

BEGIN TEST.

OPERATOR (S)

OF

EXPRESSION

EVALUATION

OF

SYSTEM ************************************************************************

178
DIVISION PASSED

SUBTRACTION PASSED

EXPONENTIATION PASSED

SUBTRACTION

AND PASSED

ADDITION

DIVISION

AND PASSED

MULTIPLICATION

END TEST.

SECTION 30.2

EVALUATION OF THE PRECEDENCE OF OPERATORS FOR EXPRESSIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES IN

THE ABSENCE OF PARENTHESES, USING CONSTANTS ONLY.

BEGIN TEST.

PRIORITY

OF

OPERATOR

EVALUATION

OF

SYSTEM ************************************************************************

MULTIPLICATION

BEFORE PASSED

ADDITION OR SUBTRACTION

DIVISION

BEFORE PASSED

ADDITION OR SUBTRACTION

EXPONENTIATION

AS FIRST OF PASSED

OPERATIONS

END TEST.

SECTION 30.3

EVALUATION OF THE PRECEDENCE OF OPERATIONS FOR THOSE

EXPRESSIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES

BUT ARE INFLUENCED BY THE USE OF PARENTHESES, USING CONSTANTS ONLY.

BEGIN TEST.

179
ALTERATION OF PRIORITY

BY

PARENTHESES

EVALUATION

OF

SYSTEM ************************************************************************

EXPRESSIONS OF

LEFT TO RIGHT SUCCESSFUL

EVALUATION

EXPRESSIONS EVALUATED

BY PRIORITY OF SUCCESSFUL

THE OPERATOR

END TEST.

180
31.0

HIERARCHY OF OPERATORS AND PARENTHESES (CONTINUED)

In this section expression will be formed using assigned variables. The

test will then consider the two major cases of operations of equal precedence

and then of unequal precedence.

31.1

Operators of Equal Priority

The objective of this test is the same as that in test 30.1. This test

uses simple numeric variables in its numerical expressions; otherwise, the

test is similar in structure and output format to test 30.1.

31.2

Operators of Different Priorities

The objective of this test is the same as the objective stated for test

30.2. This test uses simple numeric variables in its numerical expressions;

otherwise, the test is similar in structure and output format to test 30.2.

31.3

Operators of Different Priorities

with Parentheses

The objective of this test is the same as that for 30.3. This test uses simple numeric variables in its numerical expressions; otherwise, this test

is similar in structure and output format to 30.3.

*******************

* PROGRAM FILE 31 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

PROGRAM FILE 31"

SECTION 31.1"

" LEFT TO RIGHT EVALUATION FOR EXPRESSIONS

"TORS OF EQUAL PRIORITY, USING ASSIGNED SIMPLE

WITH OPERA-"

VARIABLES.

" *****NOTE : LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH"

"OPERATORS OF ONLY ADDITION OR MULTIPLICATION DOES NOT NE-"

"CESSARILY APPLY, THEREFORE, SUCH EXPRESSIONS ARE NOT TESTED”

"IN THIS TEST.*****"

l8l
0210

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

06"70

0680

0690

0700

0 710

0720

0730

0740

0750

0760

0770

PRINT " BEGIN TEST."

PRINT

PRINT TAB (18) ; "OPERATOR(S) ";TAB (40) ; "EVALUATION"

PRINT TAB (18) ; " OF ";TAB(40);" OF

PRINT TAB (18) ; "EXPRESSION ";TAB(40); M SYSTEM " PRINT 11 ****** ******************************************** n . PRINT *********** * ************ M PRINT

PRINT

LET A$="PASSED"

LET A=8

1

LET B=9

LET C=3

LET D=23

LET E=1

3

LET F=2

LET X=A/B/C

LET Xl=X-3

IF ABS (XI) < = lE-5 THEN 410

LET A$= " FAILED"

PRINT TAB (18) ; "DIVISION" ;TAB (40) ;A$

PRINT

LET A$= “PASSED"

LET X=D-E-F

LET Xl=X-8

IF ABS (XI) <=lE-5 THEN 480

LET A$="FAILED"

PRINT TAB (18) ; "SUBTRACTION" ;TAB (40) ;A$

PRINT

LET A$="PASSED"

LET X=B~C~F

LET Xl=X-531441

IF ABS (Xl ) <=1E0 THEN 550

LET A$="FAILED"

PRINT TAB (18); "EXPONENTIATION" ;TAB (40) ;A$

PRINT

LET A$="PASSED"

LET X=D-E+F

LET Xl=X-12

IF ABS (XI ) <=lE-4 THEN 620

LET A$=" FAILED"

PRINT TAB (18) ; "SUBTRACTION"

PRINT TAB (18) ; " AND ";TAB(40);A$

PRINT TAB (18);" ADDITION " PRINT

LET A$="PASSED"

LET X=A/B*C

LET Xl = X-2

7

IF ABS (XI) <=lE-4 THEN 710

LET A$=" FAILED"

PRINT TAB (18);" DIVISION

PRINT TAB (18) ; " AND ";TAB(40);A$

PRINT TAB (18) ; "MULTIPLICATION"

PRINT

PRINT " END TEST."

PRINT

PRINT

182
0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

12-70

1280

1290

1300

1310

1320

1330

1340

PRINT " SECTION 31.2"

PRINT

PRINT " EVALUATION OF THE PRECEDENCE OF OPERATORS FOR EXPRES

PRINT "SI ON S WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES IN"

PRINT "THE ABSENCE OF PARENTHESES, USING ASSIGNED SIMPLE VARIA-"

PRINT "BLES."

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT TAB (21) ; "PRIORITY" ; TAB ( 5 1 ) ; "EVALUATION"

PRINT TAB (24) ; "OF" ; TAB (55) ; "OF"

PRINT TAB (21) ; "OPERATOR" ;TAB (53) ; "SYSTEM"

PRINT •• ************************************************** H • PRINT *' **********************”

PRINT

PRINT

LET A$="PASSED"

LET G=7

LET H=20

LET 1=100

LET J = 72

LET K=6

LET L=1

0

LET M=1

1

LET X=A+F*C-G+H

LET X1=X-1 00

IF ABS (XI) < = lE-3 THEN 10-70

LET A$=" FAILED"

PRINT TAB (181; "MULTIPLICATION"

PRINT TAB (22) ; "BEFORE" ;TAB (53) ;A$

PRINT TAB (11) ; "ADDITION OR SUBTRACTION"

PRINT

LET A$="PASSED"

LET X=I +J /B-C-K

LET Xl=X-99

IF ABS (XI) <=lE-4 THEN 1160

LET A$="FAILED"

PRINT TAB (21) ; "DIVISION"

PRINT TAB (22) ; "BEFORE" ;TAB (53) ;A$

PRINT TAB (11) ; "ADDITION OR SUBTRACTION"

PRINT

LET A$="PASSED"

LET F 1=0

LET X=L+I ~F-M

LET Xl=X-9999

IF ABS (XI) <=lE-2 THEN

LET Fl=l

PRINT "EXPONENTIATION

LET X=M*C~F/B

LET X1=X-11

IF ABS (XI ) <=lE-4 THEN

LET F 1=1

PRINT "EXPONENTIATION

LET X=-A~F

LET Xl=X- (-6561

)

IF ABS (XI) <=lE-2 THEN

12-70

BEFORE ADDITION OR SUBTRACTION FAILED."

1320

BEFORE MULTIPLICATION OR DIVISION FAILED

1370

II

183
1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1 7 3 0 1740

1

7 5 0 1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

LET Fl=l

PRINT "EXPONENTIATION BEFORE UNARY FAILED."

IF F 1=0 THEN 1390

GOTO 1420

PRINT TAB (18) ; "EXPONENTIATION"

PRINT TAB (19); "AS FIRST OF " ; TAB ( 5 3 ) ; A$

PRINT TAB (20) ; "OPERATIONS"

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT " SECTION 31.3"

PRINT

PRINT " EVALUATION OF THE PRECEDENCE OF OPERATIONS FOR THOSE"

PRINT "EXPRESSIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES"

PRINT "BUT ARE INFLUENCED BY THE USE OF PARENTHESES, USING SIM-"

PRINT "PLE VARIABLES ONLY."

PRINT

PRINT

PRINT " BEGIN TEST.

PRINT

PRINT TAB (14) ; "ALTERATION OF PRIORITY TAB ( 5 1 );" EVALUATION"

PRINT TAB (24) ; "BY" ;TAB (55) ; "OF"

PRINT TAB (19) ; "PARENTHESES" ; TAB (53) ; "SYSTEM"

PRINT "************************************************** M • PRINT n ********************** u PRINT

PRINT

LET Fl=0

LET N = 4 LET 0=92

LET P=7 2 5 LET Q=274

LET R=1 998

LET S=27

LET X=A/(B/C)

LET Xl = X-2

7

IF ABS (XI) <=1E~4 THEN 1740

LET F 1=1

LET X=D- ( E-F

)

LET Xl=X-l

2

IF ABS (XI) <=lE-4 THEN 1780

LET Fl=l

LET X=N~ (C~ F)

LET Xl=X-262144

IF ABS ( Xl ) < = 1E 0 THEN 1820

LET F 1=1

LET X=D- ( E+F

)

LET Xl=X-8

IF ABS (XI) <=lE-5 THEN 1860

LET F 1=1

LET X=A/ ( B*C

)

LET Xl=X-3

IF ABS (XI) <=lE-5 THEN 1900

LET F 1=1

IF F1=0 THEN 1930

LET A $=" UNSUCCESSFUL"

18U
1920 GOTO 1940

1930 LET A $ = " SUCCESSFUL"

1940 PRINT TAB (18) ; "EXPRESSIONS OF"

1950 PRINT TAB (18) ; "LEFT TO RIGHT" ; TAB (51) ; A $

1960 PRINT TAB (20) ; "EVALUATION"

1970 PRINT

1980 LET F1=0

1990 LET X= (A+F) * (C-G) +H

2000 LET X1=X- (-312)

2010 IF ABS (XI) <=lE-3 THEN 2030

2020 LET F 1=1

2030 LET X= ( I +0 ) / ( B-C ) -K

2040 LET Xl=X-26

2050 IF ABS (XI) <=lE-4 THEN 2070

2060 LET F 1=1

2070 LET X= (P+Q

) ~ (N-F ) +R

2080 LET Xl=X-999999

2090 IF ABS (Xl ) < = 1E 0 THEN 2110

2100 LET Fl=l

2110 LET X= (M*C) ~ (B/C) /S

2120 LET Xl=X-l 3 31

2130 IF ABS (XI) <=lE-2 THEN 2150

2140 LET F 1=1

2150 LET X=(-A)~F

2160 LET Xl=X-6561

2170 IF ABS (XI) <=lE-2 THEN 2190

2180 LET F 1=1

2190 IF Fl=0 THEN 2220

2200 LET A $=" UNSUCCESSFUL"

2210 GOTO 2230

2220 LET A$=" SUCCESSFUL"

2230 PRINT TAB (14) ; "EXPRESSIONS EVALUATED"

2240 PRINT TAB (18); "BY PRIORITY OF " ; TAB ( 5 1 ) ; A $

2250 PRINT TAB (19); "THE OPERATOR"

2260 PRINT

2270 PRINT " END TEST."

2280 PRINT

2290 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 31

SECTION 31.1

185
LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH OPERATORS OF EQUAL PRIORITY, USING ASSIGNED SIMPLE VARIABLES.

*****NOTE : LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH

OPERATORS OF ONLY ADDITION OR MULTIPLICATION DOES NOT NECESSARILY APPLY, THEREFORE, SUCH EXPRESSIONS ARE NOT TESTED

IN THIS TEST.*****

BEGIN TEST.

OPERATOR (S) EVALUATION

OF OF

EXPRESSION SYSTEM ************************************************************************

DIVISION PASSED

SUBTRACTION PASSED

EXPONENTIATION PASSED

SUBTRACTION

AND PASSED

ADDITION

DIVISION

AND PASSED

MULTIPLICATION

END TEST.

SECTION 31.2

EVALUATION OF THE PRECEDENCE OF OPERATORS FOR EXPRESSIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES IN

THE ABSENCE OF PARENTHESES, USING ASSIGNED SIMPLE VARIABLES .

BEGIN TEST.

PRIORITY

OF

OPERATOR

EVALUATION

OF

SYSTEM ************************************************************************

MULTIPLICATION

BEFORE PASSED

ADDITION OR SUBTRACTION

DIVISION

BEFORE PASSED

186
ADDITION OR SUBTRACTION

EXPONENTIATION

AS FIRST OF PASSED

OPERATIONS

END TEST.

SECTION 31.3

EVALUATION OF THE PRECEDENCE OF OPERATIONS FOR THOSE

EXPRESSIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES

BUT ARE INFLUENCED BY THE USE OF PARENTHESES, USING SIMPLE VARIABLES ONLY.

BEGIN TEST.

ALTERATION OF PRIORITY

BY

PARENTHESES

EVALUATION

OF

SYSTEM ************************************************************************

EXPRESSIONS OF

LEFT TO RIGHT SUCCESSFUL

EVALUATION

EXPRESSIONS EVALUATED

BY PRIORITY OF SUCCESSFUL

THE OPERATOR

END TEST.

187
32.0 EVALUATION OF EXPRESSIONS HAVING A VARIETY OF OPERATORS

The expressions used are formed from both numerical constants and

simple-numer ic-var iabless . Each expression is characterized by either the

absence of parentheses, the use of non-nested parentheses, or the use of

nested parentheses. The objective of this test is to verify that numerical

expressions can be constructed from both numerical constants and

simple-numeric-variables using a combination of operators, with and without

parentheses, and that the system will maintain at least six decimal digits of

two column output with the first column labeled

and the second column labeled "Evaluation of

column lists the classes or categories of numeric

evaluated, while the second indicates whether the

precision. There is a "Category of Expression",

System". The first

expressions that are implementation evaluated each expression within tolerance,

system passed or failed.

i . e . whether the

*******************

* PROGRAM FILE 32 * *******************

0010

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

PRINT "PROGRAM FILE 32“

PRINT

PRINT

PRINT

PRINT " SECTION 32.0"

PRINT

PRINT " EVALUATION OF EXPRESSIONS WHICH HAVE A VARIETY OF"

PRINT "OPERATORS AND ARE OF ONE OF THREE CATEGORIES:"

PRINT

PRINT " (1) NO PARENTHESES,"

PRINT " (2) NON-NESTED PARENTHESES, AND"

PRINT " (3) NESTED PARENTHESES."

PRINT

PRINT "ALSO, THESE EXPRESSIONS ARE FORMED FROM THE USE OF BOTH"

PRINT "NUMERICAL CONSTANTS AND SIMPLE-NUMERIC-VARIABLES."

PRINT

PRINT

PRINT TAB (18);" CATEGORY "; TAB ( 3 6 );" EVALUATION"

PRINT TAB (18) ; " OF ";TAB(36);" OF

PRINT TAB (18) ; "EXPRESSION" ;TAB (36) ; " SYSTEM " PRINT "**************************************************"

PRINT "**********************"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT

LET F1=0

188
0340 LET X=3

0350 LET Y = 2 0360 LET Z = 5 0370 LET W=-6 0 0380 LET M = 92

0390 LET A=X+Y *Z-W/5 -W/5/6+18

0400 LET Al=A-45

0410 IF ABS ( Al ) <=1E-4 THEN 430

0420 LET Fl = l 0430 LET B=Y~3*4+216/3 ~Y*2+M-82

0440 LET Bl=B-90

0450 IF ABS (Bl ) <=1E- 4 THEN 470

0460 LET F 1 = 1 0470 LET C=Y*X+Y*W-Y+170

0480 LET Cl=C-54

0490 IF ABS (Cl ) <=1E- 4 THEN 510

0500 LET Fl=l

0510 LET D=W/Y+105/Z *Y ~2+3- 24

0520 LET Dl=D-3 3 0530 IF ABS (Dl ) <=1E- 4 THEN 550

0540 LET F 1 = 1 0550 LET E=Y*Y+W*Y+167 *X+Y- 124

0560 LET El=E-263

0570 IF ABS (El) <=1E- 3 THEN 590

0580 LET F 1 = 1 0590 LET F=Y*Y+Y*Y+Y *Y+Y *Y+Y-1

5

0600 LET F 2=F-3

0610 IF ABS ( F 2 ) < = 1E- 5 THEN 630

0620 LET Fl = l 0630 LET G=W+Z+X+Y+Y -X;-9 0640 LET G1=G- (-60)

0650 IF ABS (G 1 ) <=1E- 4 THEN 670

0660 LET F 1 = 1 0670 LET H=W/Z+X+Y*Y ~Y -X + l 0 0680 LET Hl=H-6

0690 IF ABS (HI) <=1E- 5 THEN 710

0700 LET F 1=1

0710 IF 1Fl<>0 THEN 740

0720 LET A$="PASSED"

0730 GOTO 750

0740 LET A$=" FAILED"

0750 LET F 1 = 0 0760 LET A= (X+Y) * (Z-W) /5-W/5/6+18

0770 LET Al=A-85

0780 IF ikBS (Al) <=1E- 4 THEN 800

0790 LET Fl = l 0800 LET B=Y~ (3*4 ) + (216/3

)

Y*2+ ( M— 8 2

)

0810 LET Bl=B-14474

0820 IF ABS ( B 1 ) <=1E- 1 THEN 840

0830 LET Fl = l 0840 LET C =Y * (X+Y) * (W- Y ) +17 0 0850 LET C1=C- (-450)

0860 IF ABS (Cl) <=1E- 3 THEN 880

0870 LET Fl = l 0880 LET D=W/Y + 10 5/Z *Y ~ (2 + 3 ) -24

0890 LET Dl=D-618

0900 IF ABS (Dl) <=1E- 3 THEN 920

189
0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

LET Fl=l

LET E=Y* (Y+W) * (Y+167) *X+(Y-124)

LET El=E- (-58934

)

IF ABS (El) <=1E-1 THEN 960

LET F 1=1

LET F=Y* (Y+Y ) *Y + (Y*Y+Y ) *Y + ( Y-15

)

LET F2=F-15

IF ABS (F2) < = lE-4 THEN 1000

LET F 1=1

LET G= (W+Z+X+Y+Y)- (X-9)

LET G1=G- (-42

)

IF ABS (Gl) <=lE-4 THEN 1040

LET Fl=l

LET H=W/ (Z+X) +Y*Y~ (Y-X) +10

LET H l=H-3 .

5

IF ABS (HI) < = lE-4 THEN 1080

LET Fl=l

IF F1O0 THEN 1110

LET B $ = " PASSED"

GOTO 1120

LET B$ = " FAILED"

LET F 1=0

LET A=Y/ (184/ (M/ (30/ (W/ (12/X) ) ) )

)

LET Al=A- (- . 5

)

IF ABS (Al) <=lE-6 THEN 1170

LET F 1=1

LET B=Y~3*4+405/(3~ ( Y *2 ) )+M-82

LET Bl=B-47

IF ABS (Bl) <=lE-4 THEN 1210

LET Fl=l

LET C=Y* (X+Y* (W-Y) ) +170

LET C 1=C- (-72

)

IF ABS (Cl) < = lE-4 THEN 1250

LET Fl=l

LET D=W/Y+121/(Z* (Y~2+3) -24)

LET Dl=D- (-19)

IF ABS (Dl) < = lE-4 THEN 1290

LET F 1=1

LET E=Y* (Y+W* (Y+167* (X+Y) ) )-124

LET E1=E- (-100560)

IF ABS (El) < = 1E 0 THEN 1330

LET F 1=1

LET F=Y* (Y+Y* (Y+Y* (Y+Y* (Y+Y) ) )

) -15

LET F 2=F-7

7

IF ABS ( F2 ) <=lE-4 THEN 1370

LET F 1=1

LET G=W+(Z+(X+(Y+(Y-(X-9) ) ) )

)

LET G1=G - (-4 2

)

IF ABS (Gl) <=lE-4 THEN 1410

LET F 1=1

LET H=W/(Z+4+(Y* (Y~ (Y-X) )+10)

)

LET Hl=H- (-3)

IF ABS (HI) <=lE-5 THEN 1450

LET Fl=l

IF F1O0 THEN 1480

LET C$="PASSED"

GOTO 1490

190
1480 LET C$="FAILED"

1490 PRINT TAB (18);" NO

1500 PRINT TAB (18) ; "PARENTHESES" ;TAB (38) ;A$

1510 PRINT

1520 PRINT TAB (18) ; "PARENTHESES"

1530 PRINT TAB (18) ; " BUT ";TAB(38);B$

1540 PRINT TAB (18) ; "NON-NESTED " 1550 PRINT

1560 PRINT TAB (18);" NESTED " 1570 PRINT TAB (18) ; "PARENTHESES" ;TAB (38) ;C$

1580 PRINT

1590 PRINT • END TEST."

1600 PRINT

1610 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 32

SECTION 32.0

EVALUATION OF EXPRESSIONS WHICH HAVE A VARIETY OF OPERATORS AND ARE OF ONE OF THREE CATEGORIES:

(1) NO PARENTHESES,

(2) NON-NESTED PARENTHESES, AND

(3) NESTED PARENTHESES.

ALSO, THESE EXPRESSIONS ARE FORMED FROM THE USE OF BOTH NUMERICAL CONSTANTS AND NUMERICALLY ASSIGNED SIMPLE VARIABLES.

CATEGORY

OF

EXPRESSION

EVALUATION

OF

SYSTEM ************************************************************************

BEGIN TEST.

NO

PARENTHESES PASSED

191
PARENTHESES

BUT PASSED

NON-NESTED

NESTED

PARENTHESES PASSED

END TEST.

192
33.0 INSERTION OF SPACES BETWEEN ELEMENTS OF

NUMERIC EXPRESSIONS

This test verifies that spaces are allowed between elements of numeric

expressions. This test uses several expressions with varying amounts of

space between component elements. On output, a message will indicate that

spaces are recognized if the test is successful; otherwise the user should

expect some form of syntax diagnostic. If no syntax error is given and the

system fails to evaluate the expressions properly a message will indicate

that spacing within expressions is not allowed even though it is not

diagnosed. For the specifications on spacing within programs the reader is

referred to section 3 of BSR X3.60.

****** *************

* PROGRAM FILE 33 * *******************

0010 PRINT "PROGRAM FILE 33"

0035 PRINT

0040 PRINT

0045 PRINT

0050 PRINT " SECTION 33.0 U 0055 PRINT

0110 PRINT " INSERTION OF SPACES BETWEEN THE COMPONENT ELEMENTS"

0120 PRINT "OF NUMERIC EXPRESSIONS."

0130 PRINT

0140 PRINT

0150 PRINT " BEGIN TEST.

0160 PRINT

0170 LET A=6

0180 LET B=-8

0190 LET C=-6

0200 LET Y=A

* 3+ 3* A "2 * B + 3 *A * 3

~ 2 + B

“ 3 0210 LET Z=A * ( C 5 )

** 3 0220 IF YO-8 THEN 0240

0230 IF Z=-7986 THEN 0270

0240 PRINT "SPACES BETWEEN COMPONENT ELEMENTS OF NUMERIC EXPRESSIONS"

0250 PRINT "ARE NOT ALLOWED BY SYSTEM."

0260 GOTO 0300

0270 PRINT "SPACES BETWEEN COMPONENT ELEMENTS OF NUMERIC EXPRESSIONS"

0280 PRINT "ARE ALLOWED BY SYSTEM."

0290 PRINT

0300 PRINT " END TEST."

0310 PRINT

0320 END

193
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 33

SECTION 33.0

INSERTION OF SPACES BETWEEN THE COMPONENT ELEMENTS

OF NUMERIC EXPRESSIONS.

BEGIN TEST.

SPACES BETWEEN COMPONENT ELEMENTS OF NUMERIC EXPRESSIONS

ARE ALLOWED BY SYSTEM.

END TEST.

19 U
NBS-114A (REV 7.73)

U.S. DEPT. OF COMM. BIBLIOGRAPHIC DATA

SHEET

1. PUBLICATION OR REPORT NO. NBS IR 78-1420-22. Gov’t Accession

No.

3. Recipient’s Accession No.

4. TITLE AND SUBTITLE

NBS Minimal BASIC Test Programs - Version 1 User's Manual

Volume 2 - General Program Structure, Output, Assignment

Simple Control Structures, Simple Expressions

5. Publication Date January 1978

6. Performing 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/Task/Work Unit No. 6401121

11. Contract/Grant No.

12. Sponsoring Organization Name and Complete Address (Street, City, State, ZIP)

National Bureau of Standards

13. Type of Report & Period Covered Final

14. Sponsoring Agency Code

15. SUPPLEMENTARY NOTES

16. ABSTRACT (A 200-word or less factual summary of most significant information. If document includes a significant bibliography or literature survey, mention it here.) This volume is the second of four volumes that comprise the user's guide to the

NBS Minimal BASIC Test Programs. The programs 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 object of this volume is to introduce elementary variable, control and expression

forms and exercise ttiem by using a large sample of variations of the appropriate

statements. There are thirty-three programs in this volume. They cover specifically

the test for output, simple assignment of variables, elementary control structures,

general program structure, formulating simple expressions, and the hierarchy of

operators. 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)

BASIC; BASIC standard; BASIC validation; compiler validation; computer programming

language; computer standards.

18. AVAILABILITY Uni imited X For Official Distribution. Do Not Release to NT1S

\_ Order From Sup. of Doc., U.S. Government Printing Office Washington, D.C. 20-102, SO Cat. No, 0 5

L"] 9'd er From National Technical Information Service (NTIS)

Springfield, Virginia 22151

19. SECURITY CLASS

(THIS REPORT)

UNCLASSIFIED

21. NO. OF PAGES

200

20. SECURITY CLASS 22. Price (THIS PAGE)

UNCLASSIFIED

USCOMM-DC 29042-P74
V

.