EasyManua.ls Logo

Commodore 16 - Page 76

Commodore 16
94 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
EXAMPLE.
100X=lNT(RND(l)-6)+INT(RND(l)*6)+2
100 X
=
rNT(RND(l)'1000)+l
100X+INT(RND<1)*150) +
100
Simuiales
2
dice.
Number from
1
-1
000.
Number from 100-249.
SGN(X) (sign)
This
function returns
the sign,
as
In
positive, negative,
or
zero,
ot X. The
result is
+ 1 it positive. II zero, and
-
1
it
negative
SW<X) {sine)
This Is
the trigonometric sine
tunction. The result
is the
sine
of
X.
where X is an
angle
In
radians,
SQR(X)
(square root)
This function
returns
the square root of
X, where X is
a
positive
number or It
X
is
negalive.
an ILLEGAL QUANTITY
ERROR results.
TAN(X) (tangent)
This gives
the tangent of
X. where
X
is
an angle in radians.
US
f
'
I
I
I
!
I
I
I
I
f
f
USR(X)
When
this function
is used,
the program lumps to a
machine language
program whose starting point is contained
in memory
locations 1281
and 1 282 The parameter X Is passed to
the
machine language
program in ihe
floating point accumulator.
Another numoer
is
passed
back to the BASIC
program through the
calling variable. In other
words,
this
allows
you to
exchange a
variable between
machine
code
and BASIC.
See the
Programmer's Reference
Guide
lor
more details
on
this,
and on
machine language
programming
VAL<XS)
This
function converts Ihe string X$ Into a number, and Is
essentially
the inverse operation trom
STRS
The
string is examined
from Ihe left-
most character lo Ihe
right, tor
as
many
characters
as
are In recognizable
number
format. If the Commodore
16 lirvds illegal characters, only the
portion ol the siring up to that
point
Is
converted
EXAMPLE:
10X«VAL("123.4S6")
10X=VAL("3E03")
10X*VAL{"12A13B")
10X
=
VALTRIUO17-")
10X-VALT-1.23.23.23")
X-123.456
X=3000
X-12
X=0
X—
1
.23
149

Other manuals for Commodore 16

Related product manuals