[ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]

#### 12.2.6.1 Arithmetic Operations

`Radtest` provides the common arithmetic operators, which follow normal precedence rules (see section Operator Precedence (How Operators Nest)), and work as you would expect them to. The only notable exception is subtraction operator (minus) which can be used as part of a variable or attribute name, and therefore expressions like `\$x-3` are ambiguous. This expression can be thought of either as a dereference of the variable `x-3` (see section Dereferencing Variables), or as subtraction of the value `3` from the value of the variable `x`. `Radtest` always resolves this ambiguityin the favor of variable dereference. Therefore we advise you to always surround minus sign by whitespace, if it is used as a subtraction operator. So, instead of `\$x-3`, write `\$x - 3`. For other methods of solving this ambiguity, See minus-ambiguity.

This table lists the arithmetic operators in order from highest precedence to lowest:

`- x`

Negation.

`+ x`

Unary plus. This is equivalent to `x`.

`x * y`

Multiplication.

`x / y`

Division.

`x % y`

Remainder.

`x + y`

`x - y`