-
Notifications
You must be signed in to change notification settings - Fork 8
BASIC Math Functions
TYPE: BASIC Numeric Function
FORMAT: ABS(number)
Action: Returns the absolute value of a number (the number alone, without a plus or minus sign). The value returned is always positive.
- expr is the numeric expression to be evaluated.
Examples:
PRINT ABS(-1)
Prints
1
the absolute value of -1.
X=ABS(-65)
PRINT X
Prints
65
the absolute value of -65.
Y=ABS(-18+X)
PRINT Y
Prints
83
the absolute value of the sum of the variable X from the previous example and the numeric literal -18.
TYPE: Extended BASIC Floating-Point Function
FORMAT: ATN(number)
Action: Returns the arc tangent of the numeric float argument.
- float is floating number to be evaluated.
Examples:
PRINT ATN(1)
Prints
π/4 ( replace with actual value returned from AQ+ )
TYPE: BASIC Floating-Point Function
FORMAT: COS(number)
Action:
This mathematical function calculates the cosine of the number, where the number is an angle in radians.
Examples:
10 PRINT COS(0)
20 X = COS( Y * 3.14159 / 180 ) : REM CONVERT DEGREES TO RADIANS
TYPE: BASIC Floating-Point Function
FORMAT: EXP(number)
Action:
This mathematical function calculates the constant e (2.71828) raised to the power of the number given. A values greater than approximately 87.33655 cause an Overflow Error to occur.
EXAMPLES of EXP Function:
10 PRINT EXP ( 1 )
20 X = Y * EXP ( Z * Q )
TYPE: BASIC Integer Function
FORMAT: INT(numeric)
Action: Returns the integer value of the expression. If the expression is positive, the fractional part is left off. If the expression is negative, any fraction causes the next lower integer to be returned.
EXAMPLES of INT Function:
A = INT(A+.5)
Round A to nearest whole number
120 PRINT INT(99.4343), INT(-12.34)
Prints 99
and -13
TYPE: BASIC Floating-Point Function
FORMAT: LOG(numeric)
Action:
Returns the natural logarithm (log to the base of e) of the argument. If the value of the argument is zero or negative the BASIC error message ?ILLEGAL QUANTITY will occur.
EXAMPLES of LOG Function:
25 PRINT LOG(45/7)
1.86075
Calculates the LOG of ARG to the base 10 :
10 NUM=LOG(ARG)/LOG(10)
TYPE: BASIC Floating-Point Function
FORMAT: RND(numeric)
Action:
RND creates and returns a random floating-point value from 0.0 to 1.0. The computer generates a sequence of random numbers by performing calculations on a starting number, which in computer jargon is called a seed. The RND function is seeded on system power-up. The numeric argument is a dummy, except for its sign (positive, zero, or negative).
If the numeric argument is positive, the same "pseudorandom" sequence of numbers is returned, starting from a given seed value. Different number sequences will result from different seeds, but any sequence is repeatable by starting from the same seed number. Having a known sequence of "random" numbers is useful in testing programs.
If you choose a numeric argument of zero, then RND returns the previously generated pseudorandom number. Negative arguments cause the RND function to be re-seeded with each function call.
EXAMPLES of RND Function:
Return random integers 0-49:
220 PRINT INT(RND(1)*50)
Simulates 2 dice:
100 X=INT(RND(1)*6)+INT(RND(1)*6)+2
Random integers from 1-1000:
100 X=INT(RND(1)*1000)+1
Random numbers from 100-249:
100 X=INT(RND(1)*150)+100
Random numbers between upper (U) and lower (L) limits:
100 X=RND(1)*(U-L)+L
TYPE: BASIC Integer Function
FORMAT: SGN(numeric)
Action:
SGN gives you an integer value depending upon the sign of the numeric argument. If the argument is positive the result is 1, if zero the result is also 0, if negative the result is -1.
EXAMPLES of SGN Function:
Jump to 100 if DV=negative, 200 if DV=0, 300 if DV=positive:
90 ON SGN(DV)+2 GOTO 100, 200, 300
TYPE: BASIC Floating-Point Function
FORMAT: SIN(numeric)
Action:
SIN gives you the sine of the numeric argument, in radians. The value of COS(X)
is equal to SIN(x+3.14159265/2)
.
EXAMPLES of SIN Function:
235 AA=SIN(1.5):PRINT AA
.997494987
TYPE: BASIC Floating-Point Function
FORMAT: SQR(numeric)
Action:
SQR gives you the value of the square root of the numeric argument. The value of the argument must not be negative, or the BASIC error message ?ILLEGAL QUANTITY will happen.
EXAMPLES of SQR Function:
FOR J = 2 TO 5: PRINT J*5, SQR(J*5): NEXT
10 3.16227766
15 3.87298335
20 4.47213595
25 5
READY
TYPE: BASIC Floating-Point Function
FORMAT: TAN(numeric)
Action:
Returns the tangent of the value of the numeric expression in radians. If the TAN
function overflows, the BASIC error message ?DIVISION BY ZERO is displayed.
EXAMPLE of TAN Function:
10 XX=.785398163: YY=TAN(XX):PRINT YY
To Search for pages in the wiki, press Pages above and type a search term in the "Find a page..." box. Results will update beneath automatically.
- Aquarius+ User Guide
- Quick Start
- Hardware
- Software
-
Other Development Resources