# Number Expressions

Number Literals

A Number may written in various forms and with different bases. A Number can be written in the normal way, such as 10, 42, 3.142 etc. There is also something known as the exponent notation based on scientific notation. A number like 2.6 x 103 can be expressed as 2.6e3 - the 'e' is used to mark the power of 10 - so the value will be 2600.

A Number can also be written in different bases - with a '#' flagging the base ( always written in decimal ). The letters A to Z are used for the digits from 10 up to 35. So 1E3#16 will be 483 decimal. Note lowercase 'e' is exponent marker, upper case 'E' is a digit. Numeric literals must always start with a conventional digit ( 0 to 9 ), so something like FF#16 will have to be written as 0FF#16.

There is a numeric Null which indicates no valid number. This is not the same as zero.

Arithmetic Operators

The 'binary' refers to the fact that there are two operands, e.g. a + b. The result will be exactly as expected provided the result fits the system limit. If the result is too bit a runtime error will result.

Binary Subtraction

This is a conventional subtraction: a - b. The result will be exactly as expected with the same proviso about the result size.

Multiplication

The operator for multiplication is '*' - this is because 'x' is used as an identifier. The usual meaning applies.

Division

The operator for division is '/' - this is because 'ũ' not available on standard keyboards. The usual meaning applies. Division be zero will generate a runtime error.

Integer Division

This is a variant on the usual division operator. It will do a standard division then strip of the fraction part. So 10 / 3 = 3.333 but 10 // 3 = 3 exactly.

Modulo

The modulo operator is a complement to the integer division. It will return the remained of the division. So 10 Mod 3 = 1; because 10 / 3 is 3 remainder 1. The operator will also work with non-integers. So 10.5 Mod 2.5 will yield 0.5 as the result.

If the numerator is negative the remainder will still be in the range 0 <= mod < n.

Unary Plus

This does not actually do anything, it is just for emphasis. So +3 is the same as 3 but in some cases, such as a For loop Step value, it just emphasises that the loop is going up.

Unary Minus

This negates the operand.

Comparison Operators

There are four comparison operators: ">=" greater than or equal; '<=' less than or equal; '>' greater than; '<' less than. They work as you would expect with numbers and all return Logical results. If either of the values is Null then the operator will generate a runtime error.

Equality Operators

There are two equality operators: '==' equals; '<>' not equals. They work as you would expect with numbers and all return Logical results. These operators can be used with Null operands - but a literal Null will need to be on the right hand side ( otherwise the system will not know what type of Null it is ).