For the complete documentation index, see llms.txt. This page is also available as Markdown.

Decimal

Fixed-precision decimal values for exact, financial-grade arithmetic.

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.

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

09

Digits

Multiple

Decimal digits

.

Decimal point

U+002E

Separates the integer and fractional parts

-

Minus sign

U+002D

Negative value

Valid forms

---
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):

A schema can constrain these; see Decimal.

Invalid forms

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

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

Last updated

Was this helpful?