> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truemath.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Scalar numbers

> Plain numeric values with no unit — the simplest value type in TrueMath.

A **scalar number** is a plain numeric value with no unit attached: a count, a ratio, a rate, or any dimensionless quantity.

## Writing scalars

```
42
3.14
-7.2
1.5e-3      # scientific notation: 0.0015
```

## Behavior

* Scalars combine with other scalars under the usual arithmetic.
* A scalar applied to a [table](/math/types/tables) operates on every cell:
  `[10; 20; 30] * 1.1`.
* A scalar combined with a [unit number](/math/types/unit-numbers) scales it:
  `3 * 5m` is a length.

Scalars are held at full precision; see [Units and precision](/concepts/units-and-precision). How a scalar is displayed — as a plain number, a percentage, or without separators — is controlled by the [variable's](/concepts/variables) display format, not by the value itself.

See [Combining types](/authoring/writing-equations#combining-types) for how scalars combine with other types.

## Booleans

TrueMath has no separate boolean type — `true` and `false` are named scalar constants equal to `1` and `0`. They are interchangeable with the numbers, so you can write whichever reads best:

```
true     # 1
false    # 0
```

[Comparison and logical operators](/math/functions/operators-and-precedence) produce a boolean (the number `1` or `0`) and expect one in a condition. Boolean flag arguments — such as `descending` in [`sort`](/math/functions/tables) or `beginning_of_period` in the [finance functions](/math/functions/finance) — accept `true`/`false` or `1`/`0`.

Equality is exact: because `true` is `1`, `1 == true` is true but `2 == true` is false.

<Accordion title="Deep details: how a condition treats other numbers">
  Inside `if`, `&&`, `||`, and `!`, the condition must reduce to a scalar. Comparing unit values is fine — `3 m < 5 m` yields the scalar `1` — but a bare unit value as the condition (`if(5 m; …)`) raises an error. A scalar counts as **true** when its absolute value is at least `0.5`, and **false** otherwise — roughly, "rounds to a nonzero number." So `if(2; …)` takes the true branch (even though `2 != true`), `if(0.4; …)` takes the false branch, and `if(-1; …)` is true. In normal use you pass `true`/`false`, `1`/`0`, or a comparison result, where this never comes up.
</Accordion>
