25 lines
835 B
Text
25 lines
835 B
Text
FUNCTION floor(x)
|
|
IF x > 0 THEN
|
|
LET floor = INT(x)
|
|
ELSE
|
|
IF x <> INT(x) THEN LET floor = INT(x) - 1 ELSE LET floor = INT(x)
|
|
END IF
|
|
END FUNCTION
|
|
|
|
PRINT "e = "; exp(1) ! e not available
|
|
PRINT "PI = "; PI
|
|
|
|
LET x = 12.345
|
|
LET y = 1.23
|
|
|
|
PRINT "sqrt = "; SQR(x), x^0.5 ! square root- NB the unusual name
|
|
PRINT "ln = "; LOG(x) ! natural logarithm base e
|
|
PRINT "log2 = "; LOG2(x) ! base 2 logarithm
|
|
PRINT "log10 = "; LOG10(x) ! base 10 logarithm
|
|
PRINT "log = "; LOG(x)/LOG(y) ! arbitrary base logarithm
|
|
PRINT "exp = "; EXP(x) ! exponential
|
|
PRINT "abs = "; ABS(-1) ! absolute value
|
|
PRINT "floor = "; floor(x) ! floor easily implemented as functions
|
|
PRINT "ceil = "; CEIL(x) ! ceiling
|
|
PRINT "power = "; x ^ y ! power
|
|
END
|