Decimal

Fixed-precision decimal values for financial and high-precision computations

A Decimal in Internet Object represents fixed-precision decimal values designed for applications that require exact numeric calculations, especially financial computations where floating-point precision issues could lead to significant errors. Decimal is a scalar primitive that stores exact numeric values with a defined precision and scale.

Unlike standard floating-point numbers (which may suffer from approximation issues), Decimal values maintain exact precision throughout arithmetic operations, ensuring accurate and predictable results.

Syntax

A Decimal value is expressed as a number with the m suffix:

decimal = decimalValue | scientificDecimal

decimalValue = ["-" | "+"] digit+ ["." digit+] "m"
scientificDecimal = decimalValue ("e" | "E") ["-" | "+"] digit+

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

Structural Characters

Symbol
Name
Unicode
Description

m

Decimal Suffix

U+006D

Identifies value as Decimal

0-9

Digits

Multiple

Standard decimal digits

.

Decimal Point

U+002E

Separates integer and fraction

-

Minus Sign

U+002D

Indicates negative numbers

e/E

Exponent

Multiple

Scientific notation exponent

Valid Forms

Basic Decimal Values

Scientific Notation

Optional Behaviors

Fixed-Precision Arithmetic

Decimal values maintain their precision throughout operations:

Precision and Scale

Each Decimal value is defined by:

  • Precision: Total number of significant digits

  • Scale: Number of digits after the decimal point

Empty Representation

Zero as a decimal:

Invalid Forms

Preservation of Structure

Internet Object preserves:

  • Exact decimal precision and scale

  • The chosen representation form (standard vs scientific notation)

  • Syntactic fidelity (as written, except that an explicit plus sign is not preserved)

However, it does not interpret:

  • Rounding behavior for operations

  • Domain-specific precision requirements

  • Currency or unit semantics

Such semantics are the responsibility of the schema layer, validators, or application logic.

See Also

Last updated

Was this helpful?