Apple ii Battery Charger User Manual


 
307 ARITHMETIC FUNCTIONS
STATEMENT SYNTAX/FUNCTION EXAMPLE
ABS ABS (expression) 120 PRINT ABS(X)
Gives the absolute value of the expression
X. ABS returns X if X>=0, -X otherwise.
STATEMENT SYNTAX/FUNCTION EXAMPLE
ATN ATN (expression) 210 PRINT ATN(X)
Gives the arcTangent of the expression X.
The result is returned in radians and ranges
from -PI/2 to PI/2 (PI/2=1.5708). If you
want to use this function, you must provide
the code in memory. See Appendix H for
implementation details.
STATEMENT SYNTAX/FUNCTION EXAMPLE
COS COS (expression) 200 PRINT COS(X)
Gives the cosine of the expression X. X is
interpreted as being in radians.
STATEMENT SYNTAX/FUNCTION EXAMPLE
EXP EXP (expression) 150 PRINT EXP(X)
Gives the constant "E" (2.71828) raised so
the power X (E^X). The maximum argu-
ment that can be passed to EXP without
overflow occurring is 88.0296.
STATEMENT SYNTAX/FUNCTION EXAMPLE
INT INT (expression) 140 PRINT INT(X)
Returns the largest integer less than or
equal to its expression X. For example:
INT(.23)=0, INT(7)=7, INT(-.1)=-1,
INT(-2)=-2, INT(1.1)=1.
The following would round X to 0 decimal
places:
INT(X*10^D+.5)/10^D
STATEMENT SYNTAX/FUNCTION EXAMPLE
LOG LOG (expression) 160 PRINT LOG(X)
Gives the natural (Base E) logarithm of its
expression X. To obtain the Base Y
logarithm of X use the formula LOG(X)/
LOG(Y). Example: The base 10 (com-
mon) log of 7 = LOG(7)/LOG(10).
STATEMENT SYNTAX/FUNCTION EXAMPLE
RND RND (parameter) 170 PRINT RND(X)
Generates a random number between 0
and 1. The parameter X controls the
generation of random numbers as follows:
X<0 starts a new sequence of random
numbers using X. Calling RND with the
same X starts the same random number
sequence. X=0 gives the last random
number generated. Repeated calls to
RND(0) will always return the same
random number. X>0 generates a new
random number between 0 and 1.