decimal: runtime arithmetic (torb_decimal_*) and ready natives #334
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Part of #34, after #332 (design record).
Goal
Implement the
Decimalruntime inruntime/(C11, newdecimal.cplus declarations intorb.h): a reference-counted value holding sign, base-10^9 limbs and anInt32scale, with the functions the manifest names:torb_decimal_add/subtract/multiply/divide/remainder/negate/absolute/equals/compare/show/hashandtorb_decimal_parse, plus the rounding and scale helpers #332 specifies. Turn thedecimalEntriesofcompiler/src/backend/c/natives.trbfromplannedRuntimeOfinto ready entries; the VM reaches them through the generated thunk table.Acceptance criteria
plannedRuntimeOfentry forDecimalis left innatives.trb;torb natives --headeroutput andruntime/machine_natives.care regenerated and committed.runtime/tests/cover the table of #332 (add/sub/mul exact, division to the context precision, remainder sign, rounding modes, parse and show round trip, scale and exponent limits, divide by zero panic, overflow panic) and run in tier B.Decimalnatives gives the same output withtorb runandtorb run --native; leak gate: live blocks at exit 0.Seed impact
None expected: the compiler sources never use
Decimal, and the natives were already declared in the manifest, so no form is new to the seed. The implementer confirms withgrep -rn Decimal compiler/srcthat nothing the seed compiles reaches aDecimalnative; if it does, split into two commits per CLAUDE.md "Seed and breaking changes" (the seed refresh itself stays Torben's).Size
One PR,
feat(runtime): ...plus afeat(natives): ...commit. Back-end change: tier B required (touchesruntime/andbackend/).Decimal#335Exactand conformance programs #336Decimalthat computes #34[loop:torbscript] refine: slice 2 of #34, next: waiting (dependency #332)
Decimal#335Decimalthat computes #34[loop:torbscript] refine: dependency #332 landed (PR #340, DECIMAL.md on main), label
readyset, next: implement[loop:torbscript] claim implement by session:loop-torbscript-20261012 until 2026-10-13T03:40Z
[loop:torbscript] implement: the worker ended on a session limit; PR #353 is open but tier A, tier B and gates are red (run 997) and the branch is not mergeable, next: fix round (rebase on main, fix the red jobs)
[loop:torbscript] claim fix by session:loop-torbscript-20261013 until 2026-10-13T09:42Z
[loop:torbscript] release fix: the worker ended on a session limit after pushing; PR #353 is now green on every required job (tier A, tier B, gates) and mergeable, merge gate review requested, next: waiting (merge gate review of PR #353)
Decimalthat computes #34Decimalthat computes #34