arithmetic basic math operations

Numbers can be combined using the four basic arithmetic operations + - * / and parentheses ( )

Traditional order of operations applies, with * and / being done before + and -. Of course, by using parentheses, you can force any order you like.

write 4 * 4 + 3 * 3
write 4 * (4 + 3) * 3

Unary - and +

You can also negate a value by putting a - before it. (Or leave a value's sign unchanged by putting a + before it.)

To avoid confusion, a - or + that is used for negation should have a space to its left but not to its right, and a - or + that is used for subtraction or addition should have spaces on both sides:

x = -5
write x - sqrt -x

Powers and Other Operations

The ** operator can be used for powers; x ** y is x raised to the y power:

write 2 ** 3

Powers also be written using pow:

write pow(2, 3)

There are many other math functions. They include sqrt, abs, round, ln, max, and sin.