SGN
Examples
SAt)E
"F
I
LE
1 /
BAS.
JOHNQDOE:
3"
saves the resident BASIC program in compressed format. The file
name is FILE1; the extension is IBAS; the password is JOHNQDOE.
The file is placed on Drive
3.
SAI,JE
"MATHPAK/T)<T",
A
saves the resident program
in
ASCII form, using the name
MATHPAK/TXT,
on
the first non-write-protected drive.
I SGN(number)
Function
I
Determines number's sign.
If
number is a negative number, SGN returns -
1.
If number is a
positive number, SGN returns
1.
If number is zero, SGN returns
0.
Examples
Y =
SGN(A
*
5)
determines what the sign of the expression A * B
is,
and passes the
appropriate number (- 1,0,1) to
Y.
Sample Program
610
INPUT
"ENTER
A
NUMBER";
)-(
620
ON
SGN(X)
+ 2 GOTO
630,
640,
650
630
PRINT
"NEGATIt,JE":
END
640
PRINT
"ZERO":
END
650
PRINT
"POSITII,JE":
END
2-159