Status after the refactor
PR #125 completed the target-dependent half of the original issue: usize and isize now expose MAX, MIN, and BITS, with 32-bit/64-bit and engine coverage. That work is complete and is no longer part of this issue.
The remaining work is a source spelling for canonical floating-point NaN values and ordinary standard-library NAN constants.
Current limitation
Silk's decimal floating-point literal grammar cannot produce an IEEE NaN bit pattern. The literal-only constant-initializer rule (SEM0086) also correctly rejects computed or call-based workarounds such as 0.0 / 0.0 and f64.fromBits(...) in a constant declaration.
Runtime NaN values are already possible, so this is API and language-spelling work rather than a blocker for floating-point execution.
Decided design
- Add a dedicated, contextually typed floating
nan literal.
- The literal defaults to
f64 and becomes f32 in an f32 context.
- It denotes the established positive canonical quiet NaN for the selected width.
- Do not add sign or payload syntax.
- Declare
pub const NAN: f32 = nan and pub const NAN: f64 = nan in ordinary standard-library source.
- Do not recognize the standard-library declarations by name in the compiler.
- Keep the literal-only constant-initializer rule; do not introduce general constant evaluation.
- Synchronize the authoritative constant specification with the already accepted target-dependent-constant delta while updating it for
nan.
Out of scope
Acceptance criteria
Status after the refactor
PR #125 completed the target-dependent half of the original issue:
usizeandisizenow exposeMAX,MIN, andBITS, with 32-bit/64-bit and engine coverage. That work is complete and is no longer part of this issue.The remaining work is a source spelling for canonical floating-point NaN values and ordinary standard-library
NANconstants.Current limitation
Silk's decimal floating-point literal grammar cannot produce an IEEE NaN bit pattern. The literal-only constant-initializer rule (
SEM0086) also correctly rejects computed or call-based workarounds such as0.0 / 0.0andf64.fromBits(...)in a constant declaration.Runtime NaN values are already possible, so this is API and language-spelling work rather than a blocker for floating-point execution.
Decided design
nanliteral.f64and becomesf32in anf32context.pub const NAN: f32 = nanandpub const NAN: f64 = nanin ordinary standard-library source.nan.Out of scope
Acceptance criteria
nanliteral.nandefaults tof64; anf32context producesf32.f32.NANandf64.NANexist as ordinary standard-library constants.SEM0086continues to reject non-literal constant initializers.