Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF (EN)

55 Those doing more complicated programming will need to know the exact way that the computer stores strings and numerics in memory. Full information is given at the end of chapter 39. Real and integer variables The numeric variables you have met so far are technically known as real variables . They can be used to store any number between 170 000 000 000 000 000 000 000 000 000 000 000 000 (1.7 X 10 38 ) and 0.000 000 000 000 000 000 000 000 000 000 000 000 001 47 (1.47 x 10 -39 ) and can include a decimal point. Of course a similar range of negative numbers can be stored too.

The problem with real numbers is that they are only stored to nine figure accuracy, although this is generally accurate enough for most purposes. Note that values can be assigned to variables in exponent format, which is especially useful with very large or very small numbers. For example, instead of typing A=15000000000000000000000000000000 , A=1.5E31 could be typed instead. Another type of numeric variable is an integer variable . Integer variable names are distinguished by having a percent sign as the last character of the variable name. They can only store whole numbers between -2,147,483,648 and +2,147,483,647.

On the other hand integer variables are held with complete accuracy – so accounting problems can be dealt with the nearest penny in Ј2M. Arithmetic calculations with integer variables are significantly faster than with real variables. (See chapter 32 for other suggestions for speeding up programs.) The two integer operators MOD and DIV are described in chapter 23. The variables A% to Z% are special in that they are permanently allocated space in memory. Typing RUN or NEW does not destroy them. As a result the variables A% to Z% can be set in one program and then used in another program later on without losing their values.

Of course the values will be lost if the machine is switched off but otherwise they will remain, even if BREAK is pressed. The variables A% to Z% are called the resident integer variables.