# Math expressions in Jira Automation: syntax and examples

URL: https://goingstellar.ro/reference/smart-values/math-expressions/

A math expression sits between {{#=}} and {{/}} and returns a number. Use it for totals, percentages, rounding and simple if/else choices, and combine it with other smart values that return numbers, such as a text length or a list size.

## Syntax

```
{{#=}}expression{{/}}
{{#=}}{{issue.comments.size}} + {{issue.labels.size}}{{/}}
```

## Arguments

- `expression` (required: yes): Numbers, operators, functions such as MIN, MAX, ABS, ROUND, FLOOR, CEILING, SQRT, IF and NOT, and smart values that return numbers

## Works on

- Operators: + - * / % ^ and the comparison and boolean operators = == != <>  >= && ||
- Returns: a number; comparisons and boolean operators return 1 or 0

## Examples

```
{{#=}}{{issue.comments.size}} + {{issue.labels.size}}{{/}}
```

Add two list sizes to get one activity number for a Slack line.

Result:

```
4
```

Run on Jira Cloud on 29 Nov 2026.

```
{{#=}}ROUND({{issue.summary.length()}} / 5, 1){{/}}
```

Divide the length of a summary by 5 and keep one decimal, which a plain divide() on whole numbers cannot do.

Result:

```
2.4
```

Run on Jira Cloud on 29 Nov 2026.

```
{{#=}}IF({{issue.comments.size}} > 1, {{issue.comments.size}} * 10, 0){{/}}
```

Pick one of two numbers from a comparison, for example a score that only counts once a thread has more than one comment.

Result:

```
20
```

Run on Jira Cloud on 29 Nov 2026.

```
{{#=}}MAX({{issue.comments.size}}, {{issue.labels.size}}){{/}}
```

Take the larger of two counts.

Result:

```
2
```

Run on Jira Cloud on 29 Nov 2026.

```
{{#=}}6 / 4{{/}}
```

Division inside an expression keeps the decimals.

Result:

```
1.5
```

Run on Jira Cloud on 29 Nov 2026.

```
{{#=}}1 || 0{{/}}
```

Boolean operators return 1 or 0, so they can feed IF() or be printed as a flag.

Result:

```
1
```

Run on Jira Cloud on 29 Nov 2026.

## Where the documentation differs

- `{{#=}}PI{{/}}`: run on Jira Cloud, 29 Nov 2026: the documentation says `The docs say PI is precise to 100 digits.`, the actual result is `3.141592653589793`.

## Pitfalls

- A number field without a value leaves the operator with nothing on its left. `{{#=}}{{issue.Invoice Amount}} * 1.2{{/}}` on an empty field fails at run time with "Unknown unary operator * at character position 1:  * 1.2" and the rule stops, while `+ 100` on the same empty field gives 100 (checked on Jira Cloud, November 2026).
- Comparison and boolean operators give 1 or 0 inside `{{#=}}`, but the comparison functions such as `gt()` give true or false as text. Do not mix the two in one condition.
- `{{#=}}PI{{/}}` prints 3.141592653589793, not the 100 digits the docs mention (checked on Jira Cloud, November 2026).
- Whole numbers divided with `divide()` lose the decimals, so a share such as 12 / 5 needs an expression to stay 2.4.

## Related

- [abs, round, floor, ceil](https://goingstellar.ro/reference/smart-values/abs-round-floor-ceil/)
- [plus(), minus(), multiply(), divide() on numbers](https://goingstellar.ro/reference/smart-values/plus-minus-multiply-divide/)
- [gt(), gte(), eq(), lt(), lte()](https://goingstellar.ro/reference/smart-values/number-comparisons/)
- [{{#if}} … {{/}}](https://goingstellar.ro/reference/smart-values/if/)
- [format() and formatWithLocale()](https://goingstellar.ro/reference/smart-values/number-format/)

## Sources

- [Jira smart values: math expressions (Atlassian Support)](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/)

