Commodore 2001-8 User Manual page 33

Table of Contents

Advertisement

The following general expressions can be used to compute the value of arc sine and arc cosine as a
function of arc tangent.
ARC SIN (Xl=ATN(XlSQR(-X'X+1)
ARC COS (Xl = - ATN(XlSQR( -
X·X
+ 1)+ 1.5708
Both the above expressions give the results in radians to be converted to degrees by mUltiplying the total
expression by 180frr. (It should be noted that in both the expressions there is a possibility of performing a
division by zero which will result in a basic error. Before using the expression, the arc cosine should be
checked for zero and before using the expression arc sine, X should be checked for it being equal to the
value of one.
MATHEMATiCAL FUNCTIONS
The largest legal number that BASIC can handle is
±
1.70141183 E
+
38. Any larger number gives an
?overflow error. The smallest magnitude that can be distinguished from 0 is 2.93873588
E -
39. Any
smaller
number will result in an underflow.
ASS
Absolute value is specified in the form ABS(X). The function returns the value of the expression as a
positive number. There is no inherent accuracy loss. For example:
PAINT ASS( -145).
INT
This expression basically rounds the current value of the parameter to the next lowest integer.
For example:
INT(.23) =0
INT(-2.5)= -3
INT(1.79)=1
Other than the inherent inaccuracy of dropping significant digits, this expression introduces no
additional inaccuracy. However, small inaccuracies in the argument could cause problems. For example,
the number four might, in fact, be stored in BASIC as 3.99999999. When this number is used in the
argument for an integer, the result is 3, not 4.
SGN
This expression returns a 1 if the sign of the number is greater than zero, a zero if the value is zero. and a
- 1 if the sign is negative. For example:
?SGN( - 45)
- 1
?SGN(+10)
1
SQA
This function calculates the square root of any number greater than zero. If a minus number is used, the
result is an ?ILLEGAL QUANTITY ERROR. Accuracy of the expression is
5
parts in 10 to the tenth for the
entire range.
?SQA(16)
The following two functions send themselves with natural algorithms. The algorithms are base
E
which
is ·2.71828183.
EXPONENT
The parameter defines the power to which the base E is raised. The limit of the parameter is 88.02969189.
29

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pet 2001-8

Table of Contents