> ## Documentation Index
> Fetch the complete documentation index at: https://7bd9503-archee-studio.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://7bd9503-archee-studio.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://7bd9503-archee-studio.manicule.dev/api/mcp.
> Every agent surface: https://7bd9503-archee-studio.manicule.dev/.well-known/llms-manifest.json

# Units and expressions (/arc/units)

<!-- agent-signals: reading_time_min: 2 · est_tokens: 775 · updated: 2026-12-05 -->
Related: [The .arc language](/arc/overview.md), [Syntax](/arc/syntax.md), [Parts, ports and mates](/arc/parts.md), [Citations](/arc/citations.md), [Sheets and reports](/arc/sheets.md), [Diagnostics](/arc/diagnostics.md)

> The unit table, dimension checks, expression syntax, the standard functions and tolerance classes.

## Units

A quantity is a number and an optional unit: `7.5 kW`, `20000 h`. A number with no unit is dimensionless. The compiler stores values in millimetres, kilograms and seconds, and prints them in the declared unit.

| Unit      | Dimension             | Type     |
| --------- | --------------------- | -------- |
| `mm`, `m` | Length                | `length` |
| `kg`      | Mass                  | `mass`   |
| `N`, `kN` | Force                 | `force`  |
| `Nm`      | Torque                | `torque` |
| `MPa`     | Stress                | `stress` |
| `kW`      | Power                 | `power`  |
| `rpm`     | Speed                 | `speed`  |
| `h`, `s`  | Time                  | `time`   |
| `deg`     | Angle (dimensionless) | `angle`  |
| `-`       | Ratio                 | `-`      |

## Dimension rules

* `+`, `-`, `==` and the relations need equal dimensions.
* `*` and `/` add and subtract the exponents. `^ INT` multiplies them.
* `sqrt` and `cbrt` need exponents divisible by 2 and 3.
* `x to U` converts to a unit of the same dimension.
* A `let`, `in` or `out` type is checked against its expression:

```text
let d: length = cbrt(16 * T / (pi * tau)) to mm
```

Integer values, such as a tooth count, use the type `-`.

## Expressions

| Form        | Example                                  |
| ----------- | ---------------------------------------- |
| Arithmetic  | `a + b`, `a * b`, `a / b`, `-a`, `a ^ 2` |
| Parentheses | `(a + b) / 2`                            |
| Constant    | `pi`                                     |
| Call        | `sqrt(x)`                                |
| Path        | `shaft2.s1.d`                            |
| Table read  | `T1."Bảng 10.5"["C45"].tau`              |
| Conversion  | `d to mm`                                |
| Relation    | `<=`, `<`, `>=`, `>`, `==`               |

## Functions

The standard functions are `sqrt cbrt abs min max ceil floor round sin cos tan up down near interp`.

`up(x, S)` rounds up to the next member of a standard series. `down` and `near` round down and to the nearest. The series live in the library `archee.standards`:

| Series          | Standard                     |
| --------------- | ---------------------------- |
| `standards.d`   | ISO 15 rolling-bearing bores |
| `standards.m`   | ISO 54 gear modules          |
| `standards.r10` | ISO 3 preferred numbers R10  |

```text
use standards = lib archee.standards
let d1: length = up(d_min, standards.d)
```

## Tolerance classes

A class after a length makes it a fit: `40 k6` is a nominal length of 40 mm with class `k6`. `H7` alone is a tolerance class. A port field such as `d = d1 k6` carries both. A fit works wherever a length does, with its nominal.

`fit.upper(x)` and `fit.lower(x)` return the signed deviations from the ISO 286 table.

## Assumed values

A literal with no citation is allowed. The compiler reports it as `assumed` (code `A01`, information), so you see which values rest on your own choice.
