EasyManuals Logo

Sinclair QL Beginner's Guide

Sinclair QL
135 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #59 background imageLoading...
Page #59 background image
The value of a floating point variable may be anything in the range:
± 10
-615
to ± 10
+615
with 8 significant figures.
Suppose in the above program sales were, exceptionally only 3p. Change line 110 to:
110 LET sales = 0.03
This system will change this to:
110 LET sales = 3E-2
To interpret this, start with 3 or 3.0 and move the decimal point -2 places, i.e. two places left. This
shows that:
3E-2 is the same as 0.03
After running the program, the average daily sales are:
1.25E-3 which is the same as 0.00125
Numbers with an E are said to be in exponent form:
(mantissa) E (exponent) = (mantissa) x 10 to the power (exponent)
INTEGER VARIABLES
Integer variables can have only whole number values in the range -32678 to 32768. The following are
examples of valid integer variable names which must end with %.
LET count% = 10
LET six_tally% = RND(10)
LET number_3% = 3
The only disadvantage of integer variables, when whole numbers are required, is the slightly
misleading % symbol on the end of the identifier. It has nothing to do with the concept of percentage.
It is just a convenient symbol tagged on to show that the variable is an integer.
NUMERIC FUNCTIONS
Using a function is a bit like making an omelette. You put in an egg which is processed according to
certain rules (the recipe) and get out an omelette. For example the function INT takes any number as
input and outputs the whole number part. Anything which is input to a function is called a parameter or
argument. INT is a function which gives the integer part of an expression. You may write:
PRINT INT(5.6)
and 5 would be the output. We say that 5.6 is the parameter and the function returns the value 5. A
function may have more than one parameter. You have already met:
RND(1 TO 6)
which is a function with two parameters. But functions always return exactly one value. This must be
so because you can put functions into expressions. For example:
PRINT 2 * INT(5.6)
would produce the output 10. It is an important property of functions that you can use them in
expressions. It follows that they must return a single value which is then used in the expression. INT
and RND are system functions: they come with the system, but later you will see how to write your
own.

Other manuals for Sinclair QL

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Sinclair QL and is the answer not in the manual?

Sinclair QL Specifications

General IconGeneral
ProcessorMotorola 68008
Clock Speed7.5 MHz
RAM128 KB (expandable to 640 KB)
ROM48 KB
Operating SystemSinclair QDOS
Release Year1984
StorageMicrodrive tape loop
Graphics256x256 pixels, 8 colors
PortsRS-232, ROM cartridge
SoundBeeper (internal speaker)

Related product manuals