Feature contract: f32-sqrt — SurfaceF32SquareRoot → f32SquareRoot (arity 1)#
(f32-sqrt A) is the correctly rounded binary32 square root of A, the
IEEE 754 squareRoot operation, on the x86-64 SSE scalar lane (sqrtss).
Added so learners can compute their own step scalars (AdamW's bias-corrected
step size is lr · sqrt(1 − β₂ᵗ) / (1 − β₁ᵗ)) instead of storing them.
1. Lexical and grammar rules, including precedence and termination#
One operand; a head form like the other f32-* heads (docs/language/GRAMMAR.md).
2. Scope and binding rules, including generated names#
None; the operand is an ordinary term.
3. Type and quantity requirements#
The operand must have a four-byte record type (one constructor, four
unrestricted Byte fields), the same requirement as f32-add; the result has
the operand's type. Diagnostic ALPHA-TYPE-F32-RECORD otherwise.
4. Effects, totality, and evaluation-order rules#
Pure and total. Special values follow the profile x86-64-sse-scalar-strict:
a NaN operand is returned quieted; sqrt(±0) = ±0; sqrt(+inf) = +inf; a
negative operand, including -inf, is invalid and gives the default NaN
0xffc00000.
5. Elaboration into existing core or a specifically versioned new core extension#
Core head RF32SquareRoot (interface tag 78), erased to RuntimeF32SquareRoot
(runtime opcode 0x3b).
6. Representation and target support, where relevant#
The evaluator lane has no float and keeps the node neutral; the native x86-64
lane lowers it to sqrtss. The reference expectation is
reference/numeric/Float32Model.alpha (modelF32SquareRoot, exact integer
root of the scaled magnitude) and the sqrt-* rows of
reference/numeric/float-arith-kat.tsv.
7. Error codes and primary/secondary origins#
ALPHA-TYPE-F32-RECORD at the operand.
8. Formatting and migration rules#
No rewrite; the form is new in alpha-2027 and absent from alpha-2026.
9. Positive, negative, execution, and edge-case tests#
tests/language/numeric/F32SquareRoot.alpha (native execution against the
KAT rows), debug/float-model-check.py (model vs KAT).
10. Compatibility with the old edition, serialized forms, and cache keys#
Interface tag 78 and runtime opcode 0x3b are new; cached interfaces written before this form contain no such tag.