**Warning!**This page documents an old version of InfluxDB, which is no longer actively developed. InfluxDB v1.3 is the most recent stable version of InfluxDB.

Note:Currently all mathematical operators work solely on`floats`

. Currently, InfluxDB converts any`int`

involved to a`float`

as any operation performed on an`int`

would return a`null`

value. This fixes the problem for all integer values up to 2^53. Issue 3614 tracks implementing true integer math, which will support values up to 2^63.

Mathematical operators follow the standard order of operations.
That is, *parentheses* take precedence to *division* and *multiplication*, which takes precedence to *addition* and *substraction*.
For example `5 / 2 + 3 * 2 = (5 / 2) + (3 * 2)`

and `5 + 2 * 3 - 2 = 5 + (2 * 3) - 2`

.

## Supported Operators

### Addition

You can add a constant.

```
SELECT A + 5 FROM add
```

You can add together other field keys.

```
SELECT A + B FROM add
```

### Subtraction

You can subtract a constant.

```
SELECT 1 - A FROM sub
```

You can subtract one field key from another field key.

```
SELECT A - B FROM sub
```

### Multiplication

You can multiply by a constant.

```
SELECT 10 * A FROM mult
```

You can multiply by other field keys.

```
SELECT A * B * C FROM mult
```

Multiplication distributes across other operators

```
SELECT 10 * (A + B + C) FROM mult
```

```
SELECT 10 * (A - B - C) FROM mult
```

```
SELECT 10 * (A + B - C) FROM mult
```

### Division

You can divide by a constant.

```
SELECT 10 / A FROM div
```

You can divide by other field keys.

```
SELECT A / B FROM div
```

Division distributes across other operators

```
SELECT 10 / (A + B + C) FROM mult
```

## Operators with Functions

The use of mathematical operators inside of function calls is currently unsupported.

For example

```
SELECT 10 * mean(value) FROM cpu
```

will work, however

```
SELECT mean(10 * value) FROM cpu
```

will yield a parse error.

## Unsupported Operators

### Inequalities

Using any of `=`

,`!=`

,`<`

,`>`

,`<=`

,`>=`

in the `SELECT`

clause yields empty results for all types.
See GitHub issue 3525.

### Miscellaneous

Using any of `%`

, `^`

will yield a parse error.
If you would like to see support for these operators open an issue.

## Logical Operators are Unsupported

Using any of `&`

,`|`

,`!|`

,`NAND`

,`XOR`

,`NOR`

will yield parse error.

Additionally using `AND`

, `OR`

in the `SELECT`

clause of a query will not behave as mathematical operators and simply yield empty results, as they are tokens in InfluxQL.