feat(types): BigInt + Decimal exact economy numbers (#52)
Types phase 2 — the "money problem". A splice-on-demand bignum engine (runtime/native/bignum.ludic, self-contained, only intrinsics) exposed as two namespaces: - BigInt.* — arbitrary-precision integer (sign-magnitude, base-1e9 limbs): from/parse, add/sub/mul/pow, div/mod (by int), cmp/eq/is_zero, to_int, str. For idle counters and exact huge currencies that overflow a 32/64-bit int. - Decimal.* — exact base-10 fixed point (BigInt mantissa + decimal scale): from/parse, exact add/sub/mul, cmp/eq, scale/rescale (truncate), str. So 0.10 + 0.20 is exactly 0.30 — no binary rounding. Both exact => deterministic; no f32/f64. Wired: parser splice trigger (g_uses_bignum), emit_call dispatch, reseeded seed, a self-asserting example (examples/library/bignum.ludic + feat_case), and per-symbol docs + inventory. All suites green incl. golden renders byte-identical and the bootstrap fixpoint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
2c9f9ac549
commit
bd6b12d2ea
35 changed files with 23274 additions and 20791 deletions
|
|
@ -383,6 +383,35 @@
|
|||
"rect-contains",
|
||||
"rect-intersects"
|
||||
],
|
||||
"bigint": [
|
||||
"bigint-from",
|
||||
"bigint-parse",
|
||||
"bigint-add",
|
||||
"bigint-sub",
|
||||
"bigint-mul",
|
||||
"bigint-neg",
|
||||
"bigint-pow",
|
||||
"bigint-div",
|
||||
"bigint-mod",
|
||||
"bigint-cmp",
|
||||
"bigint-eq",
|
||||
"bigint-is_zero",
|
||||
"bigint-to_int",
|
||||
"bigint-str"
|
||||
],
|
||||
"decimal": [
|
||||
"decimal-from",
|
||||
"decimal-parse",
|
||||
"decimal-add",
|
||||
"decimal-sub",
|
||||
"decimal-mul",
|
||||
"decimal-neg",
|
||||
"decimal-cmp",
|
||||
"decimal-eq",
|
||||
"decimal-scale",
|
||||
"decimal-rescale",
|
||||
"decimal-str"
|
||||
],
|
||||
"duration": [
|
||||
"duration-seconds",
|
||||
"duration-minutes",
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ function cmd_test() -> int {
|
|||
feat_case("library/crypto", "", "1 2 3 4 5 6 7 8 9", "crypto.ludic (Crypto SHA-256/HMAC/base64 KAT + CSPRNG shape)")
|
||||
feat_case("library/uuid", "", "1 2 3 4 5 6 7 8 9 10", "uuid.ludic (Uuid v4/v7 format, version/variant, parse/equals)")
|
||||
feat_case("library/noise", "", "1 2 3 4 5 6 7 8 9 10 11", "noise.ludic (Noise value/perlin/simplex/fbm/cellular determinism + range)")
|
||||
feat_case("library/bignum", "", "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16", "bignum.ludic (BigInt arbitrary-precision + Decimal exact base-10 money)")
|
||||
feat_case("library/regex", "", "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18", "regex.ludic (Regex match/find/groups/classes/quantifiers/replace + linear-time safety)")
|
||||
feat_case("library/grid", "", "1 2 3 4 5 6 7 8 9 10 11 12 13", "grid.ludic (Grid line/flood/line_of_sight + A* pathfinding over the tilemap)")
|
||||
feat_case("library/anim", "", "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34", "anim.ludic (Anim frame/once/pingpong/cell + Tween progress/loop/yoyo/ease/number/round/point/tint)")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue