Changes

Jump to: navigation, search

Locomotive BASIC

1,081 bytes added, 11:05, 29 January 2019
/* Functions */
run
</pre>
 
==== <code><big>RIGHT$ (<string expression>, <integer expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
run
</pre>
==== <code><big>ROUND (<numeric expression>[,<integer expression>])</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Rounds <numeric expression> to a number of decimal places or to the power of ten specified by <integer expression>. If <integer expression> less than zero, the <numeric expression> is rounded to give an absolute integer with <integer expression> number of zeros before the decimal point.
: '''Associated keywords''': ABS, CINT, FIX, INT: '''1. Example''':<pre>PRINT ROUND(1562.357,2),ROUND(1562.375,-2) 1562.36 1600</pre>: '''2. Example''':<pre>10 FOR n=4 TO -4 STEP -120 PRINT ROUND (1234.5678,n)30 PRINT "with integer expression";n40 NEXTrun</pre>==== <code>ROUND <big>SGN (n[,i1]<numeric expression>)</big></code> ====: ''BASIC 1.0 & 1.1'': FUNCTION: Determines the SiGN of the <numeric expression>. Returns -1 if <numeric expression> is less than 0, returns 0 if <numeric expression> = 0, and returns 1 if <numeric expression> is greater than zero.
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.: Example'''Associated keywords''':ABS
: '''Example''':
<pre>
10 FOR n=255 to -200 STEP -2020 PRINT ROUND(1562.357,2):"SGN returns";30 PRINT ROUNDSGN(1562.375,-2n) - prints 1562.36 1600;"for a value of";n40 NEXT nrun
</pre>
==== <code><big>SIN (<numeric expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Calculates the Real value for the Sine of <numeric expression>, defaulting to the Radian (RAD) measure mode unless otherwise declared by a DEG command.
==== <code>SGN (n)</code> ====: Returns 1 if n is positive'''Associated keywords''': ATN, 0 if n = 0COS, -1 if n is negative. ==== <code>SIN (n)</code> ====: Returns sine of n in degree or radian mode (see DEG and , RAD), TAN
: '''Example''':
<pre>
10 CLS:DEG:ORIGIN 0,20
20 FOR n=0 to 720
30 y=SIN(n)
40 PLOT n*640/720,198*y:NEXT
50 GOTO 50
run
</pre>
==== <code>SPACE$(i)</code> ====
205
edits