EasyManua.ls Logo

Radio Shack TRS-80

Radio Shack TRS-80
236 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
Loading...
Chapter
17
Coming
Up for Air
We've had a number of
heavy chapters,
and more are coming.
Exciting
as
all
this is, we
need
a
break.
How about
a
super-short
(but important) chapter?
Tho't you'd
agree.
Absolute Value
The ABSOLUTE
VALUE of
any number is that
number
without
any plus or minus,
sign.
Just
the number. Easy enough?
Type:
10
INPUT "TYPE ANY
POSITIVE OR
NEGATIVE
NUMBER"
;X
20 Y
=
ABS(X)
30 PRINT
"X",
"Y"
40 PRINT X,Y
. . .
and
RUN
,
inputting different number
values,
both
positive
and
negative.
Regardless of
what number you input
(as X),
its
absolute value "Y" is
that
same number
without the sign.
That's "sign"
like in
SGN from
an earlier chapter.
When
you're
done
playing
with this
one
and understand
it,
the
chapter
is over.
Learned in
Chapter
1
7
Function
ABS(X)
=
absolute
value
of X
Here's
a more
technical
definition: ^
If
X
is
less than
0,
then ABS(X>-
-i*x
If
X
«
%
then
ABSKX)
-
X
-
KXlJgreate;f.:than:#,
then
ABS(XJ- X
Toldym
imU.4,:?h0W
mn't
It
;;:;•:;;;:£
93

Other manuals for Radio Shack TRS-80

Related product manuals