55
SGN (X)
This function will give the value of +1 if X is positive, 0 if X is zero, and -1 if X is negative.
So SGN(4.3)=1; SGN(0)=0; SGN(-276)=-1
Example:
A=6
press
Enter
PRINT SGN (A); SGN (A-A)
press
Enter
1 0
INT (X)
This converts arguments which are not whole into the largest whole number below the
argument. So
INT
(5.9)=5; also
INT
(-5.9)=-6. Note that with negative arguments, the
absolute value of the result returned by
INT
will be greater than that of the argument.
Example
:
PRINT INT (-6.7)
press
Enter
-7
RND (X)
This will produce a random number between 1 and X if X is positive.
Example
:
PRINT RND (19)
press
Enter
You will get a number between 1 and 19.
RND
(0) will give you a number between 0
and 1.
Note
:
X cannot be negative.
STRING FUNCTIONS
We can also use functions to act on strings. Have a look at the following:
Note
:
From now on, the
Enter
key sign will be deleted for simplicity. Remember to
press the
Enter
key after each line of entry.
Summary of Contents for PreComputer Prestige
Page 1: ...COURSE BOOK...