Punctuated Numbers
I recently purchased a Tandy 1000SX computer. I have been working in BASIC, and I've noticed that when I list my program, any six-digit number has an exclamation point after it (123456!), and any eight-digit number has a pound sign after it (12345678#). To make the matter worse, these signs are also printed out when I make a hard copy listing of my program.
Could you please explain the reason for these punctuation marks?
Philip G. Crompton
Modern BASICs often have several ways to store variables. Numbers with few significant digits can be represented more compactly than numbers with more significant digits. When you type in a number, BASIC decides how much space it will need to store the number. It then places a suffix after the number to indicate which format it has used. The following table shows the types of numeric variables available in BAS1CA, GW-BAS1C, and Amiga Basic, and the number of bytes each format requires for storage:
% | integer (two bytes) |
! | single-precision floating point (four bytes) |
# | double-precision floating point (eight bytes) |
These punctuation marks can be helpful. If you store a double-precision number in a single-precision variable, your calculations are likely to be less accurate than they would be if you used a double-precision variable.