docs(decimal): design record DECIMAL.md for the exact decimal type #340
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/332-decimal-design"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #332
Slice 1 of #34 (then #334 runtime, #335 literals, #336 std surface).
What
docs/design/DECIMAL.md: value model (unscaled integer +Int32scale, negative scale allowed, no sign of zero), equality/hash/compare by value,ShowandTryFrom<String>grammar, exact+ - *,/to 34 significant digits half-even with preferred scale,%truncated and exact, six rounding modes withrounded(scale:, rounding:)anddivided(by:, scale:, rounding:), conversions from/toIntandFloat, literal handling, runtime layout and natives (the 12 planned ones plus the new ones), encoding/driver mapping, a worked example table (every result computed with Pythondecimaland checked against the rules) and the slices in order.docs/ROADMAP.md(planned natives),docs/design/RELEASE.mdsection 2,docs/design/FIRST-PARTY.mdgap 12,docs/design/ENCODING.md(theExactcase), and the entry indocs/design/index.md(documents list and generated list).Decisions beyond the comment on #34
The comment fixed the model,
/,%, equality,Show, text and literals. The record adds (all inside the language, no owner category):Roundinghas exactly the six listed modes;Decimal.tryFrom(Float)is the Show text of the float read back (shortest round-trip);Float.from(Decimal)is correctly rounded and saturates to infinity;Int64.tryFrom(Decimal)refuses a fractional part; the grammar refuses.5and5.;Decimal.zero/onebecome scale 0; the unscaled integer is exposed as text (no big integer in the language).Test
python3 tools/pdisc/scripts/pdisc.py check: ok (docs/ is excluded from pdisc by.pdisc.yaml; design records are plain Markdown without front matter, as the other 36).sh tools/check-commits.sh origin/main HEAD: Conventional Commits, linear.torb docs skill docs skills --check: not run locally (no built toolchain in the worktree, and the CI does the rest). No page that a skill carries changed (design records are not inskills/), so no regeneration is expected; CI's tier A confirms.Seed impact
None (docs only).
CI note
Main CI is red from a flaky io test (#338, fixed by another PR). A failure only on that inherited check is not caused by this PR.
Approved. Docs-only PR, scope matches #332 (record + links in ROADMAP, RELEASE, FIRST-PARTY, ENCODING, index).
/rows (1/3, 2/3, 1/7, 1/1.5, 100/3, 0.1/3) with Python decimal: identical. Hand-checked the preferred-scale rows,%, theroundedanddividedtables across all six modes, and the text-parse scale arithmetic: consistent with the stated rules.Non-blocking: none.
torb_decimal_*) and ready natives #334