haskell: Phase 10 — large integer audit, document practical 2^53 limit (10/10)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m9s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m9s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -144,8 +144,10 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
### Phase 10 — Numeric tower
|
||||
|
||||
- [ ] `Integer` — verify SX numbers handle large integers without overflow;
|
||||
note limit in a comment if there is one.
|
||||
- [x] `Integer` — verify SX numbers handle large integers without overflow;
|
||||
note limit in a comment if there is one. _Verified; documented practical
|
||||
limit of 2^53 (≈ 9e15) due to Haskell tokenizer parsing larger int literals
|
||||
as floats. Raw SX is exact to ±2^62. See header comment in `numerics.sx`._
|
||||
- [ ] `fromIntegral :: (Integral a, Num b) => a -> b` — identity in our runtime
|
||||
(all numbers share one SX type); register as a builtin no-op with the correct
|
||||
typeclass signature.
|
||||
@@ -293,6 +295,19 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
_Newest first._
|
||||
|
||||
**2026-05-07** — Phase 10 large-integer audit (numerics.sx 10/10):
|
||||
- Investigated SX number behavior in Haskell context. Findings:
|
||||
• Raw SX `*`, `+`, etc. on two ints stay exact up to ±2^62 (~4.6e18).
|
||||
• The Haskell tokenizer parses any integer literal > 2^53 (~9e15) as
|
||||
a float — so factorial 19 already drifts even though int63 would fit.
|
||||
• Once any operand is float, ops promote and decimal precision is lost.
|
||||
• `Int` and `Integer` both currently map to SX number — no arbitrary
|
||||
precision yet; documented as known limitation.
|
||||
- New `tests/numerics.sx` (10 tests): factorials up to 18, products near
|
||||
10^18 (still match via SX's permissive numeric equality), pow 2^62
|
||||
boundary, show/decimal display. Header comment captures the practical
|
||||
limit.
|
||||
|
||||
**2026-05-07** — Phase 9 conformance: `partial.hs` (7/7) → Phase 9 complete:
|
||||
- New `tests/program-partial.sx` exercising `head []`, `tail []`,
|
||||
`fromJust Nothing`, `undefined`, and user `error` from inside a `do` block;
|
||||
|
||||
Reference in New Issue
Block a user