### Arithmetic

`x`+

`y`

`x`-

`y`

`x`*

`y`

`x`/

`y`

`x`div

`y`

`x`mod

`y`

`x`

Addition (+), subtraction (-), multiplication (*), and division (/) are
all defined as usual. Division also offers two special operators:
`x` div `y` is the integer quotient of `x` and
`y`, and `x` mod `y` is the integer
remainder.

Normal arithmetic precedence rules are followed:
`a`+`b`*`c` means
`a`+(`b`*`c`). Parentheses may be used to
clarify.

### ?a..b?, ?a,b,c?: Random numbers and choices

`start`..

`end`?

`val1`,

`val2`,

`val3`,⋯?

Randomly picks a value. In the first form, the value is any floating-point number in the given range (inclusive). In the second form, you list out all the values and one of them is randomly picked. The first form always operates on numbers; the second form may use strings as well.

### |x|, |x,y|: Magnitude (absolute value)

`number`|

`x`,

`y`|

The first form computes the absolute value of `number`. This
just makes negative numbers positive; another way of looking at it is that
it just computes the distance from 0 to `number`.

The second form computes the distance from (0,0) to
`(x,y)` in a 2-dimensional plane.

### <x,y>: Angle to a point

`x`,

`y`>

Computes the angle, in degrees, from the positive X axis to the line from
(0,0) to `(x,y)`, counterclockwise. (`x` and `y`
may be any numbers; they need not be on-screen pixel coordinates.)

For example, <1,1> is 45, <0,1> is 90, <-1,0> is 180, and <0,-1> is 270.

As a special case, the value of <0,0> is defined to be 0. (Since a line of any angle passes through just the point (0,0), we could have chosen any value we wanted, or made it an error, but 0 makes things easier.)

### Rounding to integers

`x`

Rounds `x` to the nearest integer, so that 1.2 becomes 1 and 1.8
becomes 2. 1.5 rounds up to 2 as well.

`x`

Chops off the fractional part of `x`, so that 1.2, 1.8, and 1.5
all become 1, and -1.2, -1.8, and -1.5 all become -1.

`x`

Rounds `x` up to the next larger integer, so that 1.2, 1.8, and
1.5 all become 2, and -1.2, -1.8, and -1.5 all become -1.

`x`

Rounds `x` down to the next lower integer, so that 1.2, 1.8, and
1.5 all become 1, and -1.2, -1.8, and -1.5 all become -2.

### sqrt: Square root

`value`

Returns the square root of `value`. If `value` is
negative, ends the program with an error.

### curt: Cube root

`x`

Computes the cube root of `x`.

### sgn: Get the sign of a number

`x`

Returns -1 if `x` is less than zero, 0 if `x` is equal
to zero, or 1 if `x` is greater than zero.

### exp: Exponential growth

`x`

Returns `e` raised to the power of `x`, where
`e` is Euler's constant, roughly equal to 2.71828. This is the
opposite of ln.

### ln: Natural logarithm

`x`

Returns the natural logarithm of `x`. Causes an error if
`x` is less than or equal to zero. This is the opposite of exp.

### Trig functions

`angle`

`angle`

`angle`

`angle`

`angle`

`angle`

Returns the sine, cosine, tangent, cotangent, secant, or cosecant of
`angle`, which must be given in degrees.

Note these identities:

`a`= sin

`a`/ cos

`a`

`a`= cos

`a`/ sin

`a`

`a`= 1 / cos

`a`

`a`= 1 / sin

`a`

Since both cosine and sine functions can be 0, the tangent, cotangent, secant, and cosecant functions can each create a division-by-zero error at the appropriate place.