--- title: "The Brick Wall In Your Computer, Part II" type: "article" slug: "the-brick-wall-in-your-computer-3" url: "http://localhost/article/the-brick-wall-in-your-computer-3/" markdown_url: "http://localhost/article/the-brick-wall-in-your-computer-3.md" published_at: "2022-10-07T12:25:14+00:00" modified_at: "2026-08-04T11:49:06+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "Last time we found that every BASIC for every computer contains a \"BRICK WALL\" that can prevent the computer from doing what you want. Since the wall is different for every computer, we concentrated on the TS1000 and we found a couple of places where we could \"smash into it\". As mentioned last time, I…" category: - name: "Sincus News" slug: "sincus-news" taxonomy: "category" url: "http://localhost/category/periodicals/sincus-news/" post_tag: - name: "Best of Timex/Sinclair 1000 Articles and Documents" slug: "ts1000best" taxonomy: "post_tag" url: "http://localhost/tag/ts1000best/" - name: "Best of Timex/Sinclair 2068 Articles and Documents" slug: "ts2068best" taxonomy: "post_tag" url: "http://localhost/tag/ts2068best/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Tutorial" slug: "tutorial" taxonomy: "post_tag" url: "http://localhost/tag/tutorial/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Wes Brzozowski" slug: "wes-brzozowski" taxonomy: "indiv" url: "http://localhost/indiv/wes-brzozowski/" publication_r: id: 14989 title: "Sincus News" type: "periodical" url: "http://localhost/periodical/sincus-news/" authors: "Wes Brzozowski" authors_r: - name: "Wes Brzozowski" slug: "wes-brzozowski" taxonomy: "indiv" url: "http://localhost/indiv/wes-brzozowski/" volume: "4" issue: "1" issues_articles: - id: 39378 title: "SINCUS v4 n1" type: "issue" url: "http://localhost/issue/sincus-v4-n1/" pages: "10" pubdate: "November - December 1985" related_articles: - id: 45559 title: "The Brick Wall In Your Computer" type: "article" url: "http://localhost/article/the-brick-wall-in-your-computer/" - id: 45571 title: "The Brick Wall In Your Computer, Part 3" type: "article" url: "http://localhost/article/the-brick-wall-in-your-computer-part-3/" archive_link: false --- # The Brick Wall In Your Computer, Part II Last time we found that every BASIC for every computer contains a “BRICK WALL” that can prevent the computer from doing what you want. Since the wall is different for every computer, we concentrated on the TS1000 and we found a couple of places where we could “smash into it”. As mentioned last time, I don’t consider this a “bug”, since it absolutely must exist in some form. If there is a lot of available memory (and a lot of clever programmers to write the BASIC interpreter) the wall might be very hard to find, but it’s in there somewhere! To try to understand the wall, let’s look at one of the problems presented last month. If we ENTER the following into a TS1000: ``` 1 LET A = 1 2 LET B = A 3 LET B = B/3 4 LET B = B*3 5 IF A = B THEN PRINT "EQUAL" 6 IF A<>B THEN PRINT "NOT EQUAL" ``` and RUN the progam, we get a surprising result. At the end, A=1 and B=1, so we should get “EQUAL” as answer. Instead we get “NOT EQUAL”. Curious. If we change the order of lines 3 and 4, which shouldn’t change the answer, we get “EQUAL” as an answer. Curiouser and curiouser. If, instead of changing lines 3 and 4, we transpose the A and B in line 5 (i.e. IF B=A THEN PRINT “EQUAL”), we will get BOTH “EQUAL” and “NOT EQUAL”!!!?? Rather than get involved in binary numbers right now, let’s imagine a computer that really works in decimal. Now it’s possible to specify a number that contains an infinite number of digits. Alas, we can’t build a memory large enough to contain such a number, even with memory as cheap as it is these days. What we need to do is work out a scheme that let’s us store numbers that can be pretty large or pretty small, and hope that we never need to exceed the limit. We might do it with the following format: ``` EXPONET MANTISSA XX XXXX ``` The mantissa is a fraction with four decimal places. The exponent is a number that tells us how far to move the decimal point to the left or right. For example: ``` 02 .1000 = 10 51 .1000 = 1 (with 50 zeroes) 00 .3720 = .372 -02 .1200 = .0012 05 .5432 = 54,321 ``` Get the idea? Note that in the last case there aren’t enough digits to exactly represent the number. As such 54321 and 54320 would be the same to the computer. This is the foundation of the “BRICK WALL”. Now if we walk things through the program that gives us funny answers, we get in lines 1 and 2: ``` A=B= 01 .1000 =1 ``` In line 3 we divide 1 by 3. However, 1/3 = .3333333… where the 3’s go on forever. The computer shortens this to ``` 00 .3333 = .3333 ``` In line 4, we multiply this by 3 to get 00 .9999 = .9999. Note that .9999 is “NOT EQUAL” to 1, even though they’re very close! Therefore, the computer prints “NOT EQUAL”. Now let’s try the second case, where we change the order of lines 3 and 4. In line 3, we multiply by 3, where ``` 3 x 1 = 3 = 01 .3000 ``` In line 4 we divide by 3, to get 01 .1000 = 1. The result is still 1, so we get “EQUAL” as an answer. Although the TS1000 does these contortions in binary and there are many more digits in a number, the same problems occurs. ### **The “BRICK WALL” is revealed!** Could the BASIC interpreter have been rewritten so that the “EQUALS” test would pass if the number were merely “ALMOST EQUAL”? The answer is “Yes”, in fact, some BASICS operate in this manner. It’s possible for this reason that the TS2068 always gives “EQUAL” as an answer to this program. However, this can also have it’s problems, since there could be cases where it would falsely call two numbers equal, when they really should not be. The “BRICK WALL” is still there; it’s just moved to a different place! We still haven’t discussed the case where both “EQUAL” and “NOT EQUAL” appear together. Did I say that the TS1000 NEVER passes the “EQUALS” test when the numbers are almost equal? (No, I didn’t, look again.) Apparently, “ALMOST EQUAL” might be good enough, depending on the order of the numbers being tested. If this seems unreasonable, then I’ll have to concede this is more of a “bug” than a “BRICK WALL” problem. Nevertheless, it’s a great bug. It’s somewhat amusing to be able to show two numbers to be equal and not equal at the same time. If there are some kids in your neighborhood who are “too smart” with computers, show that problem to them. It’ll put them in their place. For space reasons, we’ll have to cover the FOR loop problem next time, although there’s enough information for the reader to figure it out if they haven’t already done so. Also, having thoroughly disgraced the TS1000 here, we’ll continue to pick on the TS2068.