FS FormScript

Arithmetic

Money and dates that match

A fee, a tax, or a repayment is wrong by a fraction of a cent because 0.1 + 0.2 is not 0.3 in IEEE-754 binary.

what this buys you

  • decimal128 in the data plane
  • Round-half-even
  • An integer is not a number
  • The canonical form on the wire
Language specification 1.0 · level 3 of 5

Promise. Under profile core-2026.1, number is decimal128: 34 significant digits, round-half-even. 0.1 + 0.2 == 0.3 is true. An integer is not a number — 1 + 1 and 1 + 1.0 differ by type, and the conformance suite checks both.

Decimal128 in the data plane

34 significant digits, round-half-even. 0.1 + 0.2 == 0.3 is true, and the suite checks it.

Integer is not number

1 + 1 and 1 + 1.0 differ by type. Quantity and price stop being interchangeable by accident.

Canonical form on the wire

A number that cannot ride in a JSON number without losing its canonical form is emitted as a JSON string.

forms
form invoice version = "1.0" {
  field unit_price { type = number, validate { min = 0 } }
  field quantity { type = integer, validate { min = 1 } }
  field vat {
    type = number
    value = round(unit_price * quantity * 0.2, 2)
  }
  field monthly {
    type = number
    value = round((unit_price * quantity + vat) / 12, 2)
  }
  output {
    unit_price: number
    quantity: integer
    vat: number
    monthly: number
  }
}

On the wire, numbers that cannot ride in a JSON number without losing the canonical form are emitted as JSON strings.

Boundary. Displayed currency strings are presentation. Stored amounts are decimals. The two planes must not mix (`E-TYPE-08`).