Math in computer science follows the rules you already know about the order in which calculations should be performed:

- First, do things in parentheses
- Then, calculate the exponents
- Multiply, divide, and modulo afterward
- Finally, add and subtract
Cast at the very end.

For example:

```
2 + 5 * 2 // 12
2 + 8 * 4 % 6 - 4 // 30
5 + 36 % 6 - 10 // 1
(5 + 6) / (11 - 9.0) // 5.5
(double)(3/4) // 0.0
```