# Drawstep engine · Values · `math` > Math — CR 107.1-107.3, 608.2h: recursive arithmetic: add (+), subtract (-), multiply (*) including twice X, divide (/) with round up/down (default down; zero divisor gives zero), or min/max of two values. Negative results remain negative for P/T; effects clamp amounts where the rules require. A printed minus sign (-X/-X) is multiplication by -1. Engine: Magic: The Gathering (`mtg`). This is one primitive of the Drawstep card vocabulary; field names and the discriminator are exact. Wiki page: https://drawstep.xyz/wiki/mtg/values#math ## Where it goes A number: `{ "kind": "math", … }` wherever a ValueDef is accepted (`amount`, `power`, `max`, `count` …); a plain integer is also a ValueDef. ## Fields | Field | Type | Required | Description | |---|---|---|---| | `op` | `"+" \| "-" \| "*" \| "/" \| "min" \| "max"` | yes | Arithmetic: + − * / min max | | `a` | `ValueDef` | yes | The first operand | | `b` | `ValueDef` | yes | The second operand | | `round` | `"up" \| "down"` | no | Rounding of a division: up or down | ## Minimal form ```json {"kind":"math","op":"+","a":1,"b":1} ``` The engine reads that minimal form as: “1 plus one”. ## Stock examples - **Token Snapshot** — “” ```json {"kind":"math","op":"/","a":{"kind":"lifeTotal","who":"you"},"b":2,"round":"up"} ``` - **Iter29 Half** — “Draw half X cards, rounded up.” ```json {"kind":"math","op":"/","a":{"kind":"var","name":"X"},"b":2,"round":"up"} ``` - **Half Life** — “Each player loses half their life, rounded up.” ```json {"kind":"math","op":"/","a":{"kind":"lifeTotal","who":"current"},"b":2,"round":"up"} ``` ## Related - [Values](https://drawstep.xyz/wiki/mtg/values.md) — the whole topic - [Values](https://drawstep.xyz/wiki/mtg/values.md) — every number kind an `amount` accepts - [Start here](https://drawstep.xyz/wiki/mtg/start.md) — the rules, the output contract and the index of every primitive