--- title: "Significant Figures" id: 76605 type: "computer_media" slug: "significant-figures" url: "http://localhost/computer_media/significant-figures/" markdown_url: "http://localhost/computer_media/significant-figures.md" published_at: "2026-11-11T08:02:20+00:00" modified_at: "2026-11-11T08:02:20+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/significant-figures-1.png" excerpt: "Round any number to the number of significant figures you choose, with a subroutine you can add to your own ZX81 programs." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" - name: "ZX81" slug: "zx81" taxonomy: "post_tag" url: "http://localhost/tag/zx81/" model: - name: "Sinclair ZX81" slug: "zx81" taxonomy: "model" url: "http://localhost/model/zx81/" - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" indiv: - name: "N. Handshaw Clark" slug: "n-handshaw-clark" taxonomy: "indiv" url: "http://localhost/indiv/n-handshaw-clark/" genre: - name: "Mathematics" slug: "mathematics" taxonomy: "genre" url: "http://localhost/type/mathematics/" media_type: "Program" programmers: - name: "N. Handshaw Clark" slug: "n-handshaw-clark" taxonomy: "indiv" url: "http://localhost/indiv/n-handshaw-clark/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Significant%20Figures%20%281982%29%28Clark%2C%20N.%20Handshaw%29%28TS1000%29%28US%29%28Program%29.zip" mediadate: "1982" images: - url: "http://localhost/wp-content/uploads/2026/11/significant-figures-1.png" - url: "http://localhost/wp-content/uploads/2026/11/significant-figures-2.png" article_media: - id: 19320 title: "Significant Figures Subroutine" type: "article" url: "http://localhost/article/significant-figures-subroutine/" media_type_tags: "Mathematics" license: false --- # Significant Figures The subroutine at line 1000 rounds the number in Z to SF significant figures. The lines in front of it are a short demonstration: RUN asks HOW MANY SIGNIFICANT FIQURES DO YOU WISH? (printed that way) and then for a number, and prints the rounded value. Powers of ten are set with 1E1 to 1E13 in lines 1190-1310 because 10**I is not exact on the ZX81. In testing, 0.000098765432 to 6 figures gave .0000987654 and 123456.78 to 3 figures gave 123000. It runs in 2K; in a 1K ZX81 it did not run. Published in Syntax September 1982 ([Significant Figures Subroutine](https://timexsinclair.com/article/significant-figures-subroutine/)). ## Source Code ``` 10 REM "ANY PROGRAM" 20 PRINT "HOW MANY SIGNIFICANT FIQURES DO YOU WISH?" 30 INPUT SF 40 CLS 50 PRINT "INPUT NUMBER:" 60 INPUT Z 70 CLS 80 GOSUB 1000 90 PRINT Z 100 STOP 1000 REM "SIGNIFICANT FIQURES" 1010 FAST 1020 LET I=SF 1030 GOSUB 1180 1040 LET ESF=QE 1050 IF ABS Z>=(ESF) THEN GOTO 1120 1060 FOR I=0 TO 30 1070 GOSUB 1180 1080 LET W=INT ((ABS Z+(0.5/QE))*QE) 1090 IF W<(ESF/1E1) THEN NEXT I 1100 LET Z=(Z/(ABS Z))*(W/QE) 1110 RETURN 1120 FOR I=0 TO 30 1130 GOSUB 1180 1140 LET W=INT ((ABS Z+(0.5*QE))/QE) 1150 IF W>=(ESF) THEN NEXT I 1160 LET Z=(Z/(ABS Z))*W*QE 1170 RETURN 1180 LET QE=10**I 1190 IF I=1 THEN LET QE=1E1 1200 IF I=2 THEN LET QE=1E2 1210 IF I=3 THEN LET QE=1E3 1220 IF I=4 THEN LET QE=1E4 1230 IF I=5 THEN LET QE=1E5 1240 IF I=6 THEN LET QE=1E6 1250 IF I=7 THEN LET QE=1E7 1260 IF I=8 THEN LET QE=1E8 1270 IF I=9 THEN LET QE=1E9 1280 IF I=10 THEN LET QE=1E10 1290 IF I=11 THEN LET QE=1E11 1300 IF I=12 THEN LET QE=1E12 1310 IF I=13 THEN LET QE=1E13 1320 RETURN ```