> For the complete documentation index, see [llms.txt](https://docs.uniot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uniot.io/platform/sandbox/visual-editor/math.md).

# Math

Math blocks provide numerical operations and calculations for your scripts. Use these blocks to perform arithmetic, apply mathematical functions, and manipulate numeric values from sensors or variables.

## value

<div align="left"><figure><img src="/files/ExGtOpZ6GvTmsOoRLSBs" alt=""><figcaption></figcaption></figure></div>

A numeric constant. Use this block to provide fixed numbers for calculations, comparisons, or as parameters to other blocks.

**Parameters:**

* **Value** (Number): Enter any numeric value (integers or decimals)

**Example:**

<figure><img src="/files/l4Kn7BZaE405OunkGJbO" alt=""><figcaption><p>Define temperature thresholds</p></figcaption></figure>

## math operation

<div align="left"><figure><img src="/files/B8LxoUw8AyBNNQUY1JpR" alt=""><figcaption></figcaption></figure></div>

Applies a single-value mathematical operation. Choose from absolute value (removes sign) or negation (flips positive to negative and vice versa).

**Parameters:**

* **Operation**: Select `abs` (absolute value) or `-` (negate)
* **Value** (Number): The number to operate on

**Returns:**

* **Number**: The result of the operation

**Example:**

<figure><img src="/files/f85NMRimfZFXRacWc7DI" alt=""><figcaption><p>Temperature difference calculation</p></figcaption></figure>

## arithmetic

<div align="left"><figure><img src="/files/ifF8Jo1IIq2vUCJDAGcY" alt=""><figcaption></figcaption></figure></div>

Performs basic arithmetic operations between two numbers.

**Parameters:**

* **Left Value** (Number): The first number
* **Operator**: Choose `+` (add), `-` (subtract), `×` (multiply), `÷` (divide), `^` (power)
* **Right Value** (Number): The second number

**Returns:**

* **Number**: The result of the calculation

**Example:**

<figure><img src="/files/bhqwIKcldGbSNsIzlPRN" alt=""><figcaption><p>Convert raw sensor value to voltage</p></figcaption></figure>

## number condition

<div align="left"><figure><img src="/files/J3gQY75vahgepeCqSJI5" alt=""><figcaption></figcaption></figure></div>

Checks whether a number meets a specific condition. Use this for pattern detection or periodic actions.

**Parameters:**

* **Value** (Number): The number to check
* **Condition**: Select `even`, `odd`, `positive`, `negative`, `whole`, `divisible by`

**Returns:**

* **Boolean**: `#t` (true) if the condition is met, `()` (false) otherwise

**Example:**

<figure><img src="/files/iWnHCXqjKI3BYkvG892e" alt=""><figcaption><p>Read sensor value every 5th script execution</p></figcaption></figure>

## remainder

<div align="left"><figure><img src="/files/EALKl4Hzy8KVtjAx0C2h" alt=""><figcaption></figcaption></figure></div>

Calculates the remainder after dividing one number by another (modulo operation). Useful for creating repeating patterns or detecting multiples.

**Parameters:**

* **Dividend** (Number): The number to be divided
* **Divisor** (Number): The number to divide by

**Returns:**

* **Number**: The remainder of the division

**Example:**

<figure><img src="/files/45lNd4VuTOE0DLgUQMym" alt=""><figcaption><p>Alternate on/off pattern for multiple LEDs</p></figcaption></figure>
