72e54f4fd3
The surface-form file extension changes from .ailx to .ail. AILang's
authoring surface now uses the same .ail stem as its canonical JSON
form (.ail.json), giving the language a single coherent extension
family: .ail is the LLM-authored Form A, .ail.json is the canonical
JSON-AST Form B.
Scope (touched):
- 61 example renames examples/**/*.ailx → .ail (git mv)
- 1 rename experiments/.../rendered/ailx.md → ail.md
- 35 content-edited live-toolchain files (crates/, docs/DESIGN.md,
docs/roadmap.md, docs/PROSE_ROUNDTRIP.md, skills/, bench/reference/*.c,
experiment crates under experiments/.../{render,harness,master})
- Experiment-crate cohort rename Cohort::Ailx → Cohort::Ail,
Form::Ailx → Form::Ail, per_cohort/ailx → per_cohort/ail,
{form-only: ailx} → {form-only: ail}, ```ailx → ```ail
Out of scope (deliberately untouched, to preserve honest history):
- docs/journal-archive.md (content-frozen per CLAUDE.md)
- docs/journals/, docs/specs/, docs/plans/, bench/orchestrator-stats/
- experiments/.../runs/ (frozen LLM-output artefacts; models actually
saw .ailx — renaming would falsify the experimental record)
Verification: cargo build/test --workspace green; experiment crate
cargo test green; bench/check.py + compile_check.py + cross_lang.py
all 0-regressed; negative grep for ailx|Ailx|AILX outside the
out-of-scope paths returns zero matches.
Opens immediate follow-up: roadmap.md P2 todo `ail check`/build/run
accept .ail extension — after this rename, .ail is canonical
authoring surface but the CLI still produces a misleading JSON-parse
error on `ail check foo.ail`. That's the next iter.
56 lines
1.9 KiB
Plaintext
56 lines
1.9 KiB
Plaintext
; Fieldtest — Floats milestone, axis 3: NaN / Inf / is_nan handling.
|
|
;
|
|
; safe_div(a, b) returns a/b when b != 0; falls through to the IEEE
|
|
; result otherwise. The fixture exercises four cases:
|
|
; 1) 6.0 / 3.0 -> 2.0 (normal)
|
|
; 2) 1.0 / 0.0 -> +inf (use is_nan to confirm finite-vs-NaN)
|
|
; 3) 0.0 / 0.0 -> NaN (is_nan should report true)
|
|
; 4) (- 1.0 1.0) / 0.0 -> NaN (subexpr drives same)
|
|
;
|
|
; classify(x) returns:
|
|
; -1 if x is NaN
|
|
; 0 if x is +inf or -inf (we test via x > <huge> / x < -<huge>)
|
|
; 1 otherwise
|
|
;
|
|
; The subtle point: the IEEE-correct way to test for NaN is `is_nan`,
|
|
; NOT `(== x x)` (which is false for NaN — but the LLM author who
|
|
; reaches for `==` first will get the right answer by accident here,
|
|
; only because the natural reading of the operator doesn't apply).
|
|
; The DESIGN.md says explicitly to use `is_nan`.
|
|
;
|
|
; Expected stdout (one per line):
|
|
; 2.0 ; 6/3
|
|
; 1 ; classify(2.0) -> normal
|
|
; inf ; 1/0
|
|
; 0 ; classify(1/0) -> infinite
|
|
; nan ; 0/0
|
|
; -1 ; classify(0/0) -> NaN
|
|
;
|
|
; (`io/print_float` prints "%g\n", so inf prints as "inf", NaN as "nan".)
|
|
|
|
(module floats_3_safe_division
|
|
|
|
(fn classify
|
|
(doc "-1=NaN, 0=infinite, 1=finite. Uses is_nan + abs > huge.")
|
|
(type (fn-type (params (con Float)) (ret (con Int))))
|
|
(params x)
|
|
(body
|
|
(if (app is_nan x)
|
|
-1
|
|
(if (app > x 1.0e308)
|
|
0
|
|
(if (app < x -1.0e308)
|
|
0
|
|
1)))))
|
|
|
|
(fn main
|
|
(type (fn-type (params) (ret (con Unit)) (effects IO)))
|
|
(params)
|
|
(body
|
|
(seq (do io/print_float (app / 6.0 3.0))
|
|
(seq (do io/print_int (app classify (app / 6.0 3.0)))
|
|
(seq (do io/print_float (app / 1.0 0.0))
|
|
(seq (do io/print_int (app classify (app / 1.0 0.0)))
|
|
(seq (do io/print_float (app / 0.0 0.0))
|
|
(do io/print_int (app classify (app / 0.0 0.0)))))))))))
|