Real constants and functions: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) |
(Real constants and functions en True BASIC) |
||
Line 2,895: | Line 2,895: | ||
| <math>x^y </math> || <code style="font-family:'TI Uni'">x^y </code> |
| <math>x^y </math> || <code style="font-family:'TI Uni'">x^y </code> |
||
|} |
|} |
||
=={{header|True BASIC}}== |
|||
<lang qbasic>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</lang> |
|||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |