> For the complete documentation index, see [llms.txt](https://docs.internetobject.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.internetobject.org/structure-and-syntax/values/number/decimal.md).

# Decimal

A **Decimal** is a fixed-precision decimal value for cases that demand exact numbers — especially financial calculations, where floating-point approximation can introduce errors. A Decimal stores an exact value with a defined precision and scale.

Unlike a standard floating-point Number, a Decimal does not approximate: `0.1m` is exactly one-tenth, not the nearest binary fraction.

## Syntax

A Decimal is written as a number with the `m` suffix. It requires a leading digit and, if a decimal point is present, at least one digit after it. Scientific notation is **not** supported.

```ebnf
decimal = ["-" | "+"] digit+ [ "." digit+ ] "m"

digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
```

## Structural characters

| Symbol  | Name           | Unicode  | Description                                |
| ------- | -------------- | -------- | ------------------------------------------ |
| `m`     | Decimal suffix | `U+006D` | Marks the value as a Decimal               |
| `0`–`9` | Digits         | Multiple | Decimal digits                             |
| `.`     | Decimal point  | `U+002E` | Separates the integer and fractional parts |
| `-`     | Minus sign     | `U+002D` | Negative value                             |

## Valid forms

```ruby
---
123.45m, 123m, 0.001m, -789.01m, 0m, 0.0m
```

* `123.45m` — fractional decimal
* `123m` — integer decimal
* `0.001m` — leading zeros preserved
* `-789.01m` — negative decimal
* `0m`, `0.0m` — zero, with and without a scale

## Precision and scale

Each Decimal carries a **precision** (the total number of significant digits) and a **scale** (the number of digits after the decimal point):

```ruby
123.45m              # precision 5, scale 2
0.000123m            # precision 6, scale 6
```

A schema can constrain these; see [Decimal](/schema-definition-language/data-types/decimal.md).

## Invalid forms

A Decimal requires a leading digit and, with a decimal point, a trailing digit. Scientific notation is rejected:

```ruby
---
1.23e2m              # ✗ scientific notation is not supported for Decimal
```

```ruby
.45m                 # ✗ missing leading digit (use 0.45m)
123.m                # ✗ missing trailing digit (use 123.0m or 123m)
123.45mm             # ✗ duplicated suffix
```

> A plain `123.45` (no `m`) is a valid **Number**, not a Decimal — the `m` suffix is what selects fixed precision.

## Preservation of structure

Internet Object preserves:

* Exact decimal precision and scale
* Syntactic fidelity as written, except that an explicit `+` sign is not preserved

It does **not** interpret:

* Rounding behavior for operations
* Currency or unit semantics

Those semantics belong to the schema, the validator, or the application.

## See Also

* [Numeric Values](/structure-and-syntax/values/number.md) — all numeric forms
* [Number](/structure-and-syntax/values/number/number.md) — standard floating-point numbers
* [BigInt](/structure-and-syntax/values/number/bigint.md) — arbitrary-precision integers


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.internetobject.org/structure-and-syntax/values/number/decimal.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
