Roadmap / Floats

NaN payloads

NaN payloads, which NaN a floating-point operation may return

Area
Floats
Kind
construct
Level
L1 (modelled in Lean). Next: L2 needs a recorded GPU run (a conformance test, not a proof).
Evidence present above the level
L3 (shown, not counted, until the levels below have their evidence)
Evidence
Reference
LLVM LangRef 24.0.0git #behavior-of-floating-point-nan-values
Quote
No quote yet.
Lean declarations
  • MojoProof.Sem.NaNEq
  • MojoProof.Sem.nanEq_deliver
  • MojoProof.Sem.isNaN_deliver
  • MojoProof.Sem.floatOp_isNaN
  • MojoProof.Sem.floatOp_nanEq
  • MojoProof.Sem.fbin_isNaN
  • FloatLib.Floats.Formats.BinaryInterchange.Model.isNaN
  • FloatLib.Floats.Formats.BinaryInterchange.Model.isSignaling
  • FloatLib.Floats.Formats.BinaryInterchange.Model.quietNaN
Corpus files
None yet.

0 kernel files (.ll) in the corpus.

Tests
  • MojoProofTest.Payload
  • MojoProofTest.PayloadRun
Upstream issue
None filed.
Depends on
floats/deliver

The rule. LangRef lets an operation whose result is a NaN return a NaN from a set: a quiet copy of an input NaN, or a preferred or target-defined NaN, with any sign.

In Lean. The semantics allows any NaN (MojoProof.Sem.deliver on a NaN result), a superset of LangRef's set, and states what does not depend on the choice through NaNEq (two values equal but for the NaNs' bits): nanEq_deliver, floatOp_nanEq. The kernel theorems of vadd and vmul hold for every choice.

Out of scope. Narrowing the set to LangRef's (a program that inspects a NaN's payload bits is then proved about more results than LLVM allows, never fewer).

Open. L2: no recorded GPU run. Ref: quote to be added.