User Tools

Site Tools


plato:tutor:appendix_c1

Appendix C: List of Builtin -calc- Functions

Trigonometry Functions
sin(x) sine
cos(x) cosine
arctan(x) arctangent

Angles are measured in radians. For example, sin(45) means sine of 45 radians, but sin (45Β°) means sine of 45 degrees (0.707). The degree sign (MICRO-o) converts to radians. Similarly, arctan(1) is .785 radians, which can be converted to degrees by dividing by 1Β°, the number of radians in one degree; arctan(1)/1Β° is 45. Using the degree sign after a number is equivalent to multiplying the number by (2Ο€/360). Ο€ (MICRO-p) is 3.14159. . . .

Arithmetic Functions
sqrt(x) square root; can also be written x1/2 or x.5
log(x) logarithm, base 10
ln(x) natural logarithm, base e
exp(x) ex
abs(x) absolute value; abs(-7) is 7
round(x) round to nearest integer; round(8.6) is 9
int(x) integer part; int(8.6) is 8
frac(x) fractional part; frac(8.6) is 0.6
sign(x) +1 if x>0, 0 if x=0, -1 if x<0
Logical Tests
=, β‰ , <, >, ≀, β‰₯ produce logical values (true=-1,false=0)
not(x) true if both x and y are true
x $or$ y true if either x or y is true (or both)
Bit Manipulation
x $cls$ y circular left shift x by y bit positions
x $ars$ Y arithmetic right shift x by y bit positions
x $mask$ y sets bits where both x and y have bits set
x $union$ y sets bits where either x or y has bits set (or both)
x $diff$ y sets bits where x and y differ (exclusive union)
bitcnt(x) counts bits

The logical operators (=, β‰ , <, >, ≀, and β‰₯) consider two quantities to be equal if they differ by less than one part in 1011 (relative tolerance) or by an absolute difference of 10-9. One consequence is that all numbers within 10-9 of zero are considered equal. Similarly, β€œint” and β€œfrac” round their arguments by 10-9 so that int(3.999999999) is 4, not 3, and frac(3.999999999) is 0, not 1. This is done because a value of 3.999999999 is usually due to roundoff errors made by the computer in attempting to calculate a result of 4.

System Variables

Discussed in This Book Not Discussed in This Book
anscnt baseu aarea
args capital aarrows
clock dataon ahelp
formok entire ahelpn
jcount error aok
key errtype aokist
opcnt extra asno
spell judged aterm
station ldone atermn
varcnt lscore atime
vocab lstatus auno
where mainu
wherex mode
wherey nhelpop
ntries
order
phrase
size
user
wcount
zreturn

The third column consists of counters associated with the -area- command.

There are some additional system variables available for special purposes. See the on-line PLATO aids for information.


plato/tutor/appendix_c1.txt Β· Last modified: 2023/08/05 18:55 by Site Administrator