t81-foundation

Checked floating-point conversion: executable draft

This directory supports draft RFC-00D5. It defines proposed numerical results, not production compliance, a replacement implementation, or a cross-platform floating-point determinism claim. The proposed decision record and compatibility/implementation plan identify every approval needed before production work.

From the repository root, with Python >=3.10 and no packages or T81 build:

python3 experiments/checked_float_contract/test_reference.py
python3 experiments/float_conversion_audit/test_oracle.py

reference.py uses Python integers and Fraction only. It models both binary64 input and output, exact-only and explicit nearest-even modes, structured errors, strict finite canonical text and negative-zero normalization metadata. Its rational quantization helper permits exact tie/range fixtures without turning those fixture constructors into another proposed public API.

corpus.json has 104 static requests and explicit expected structured results. Large rational numerators/denominators are decimal strings; binary64 values are 16 lowercase hex digits. Each request names an operation, optional M/E (defaults 27/9), and optional mode (default exact_only). Expected status/value/error/flags must all match, not just a hash. No machine paths, timestamps, native float literals or production observations determine expectations.

Expected values were constructed from exact integers, known binary64 field encodings and rational inequalities. The test suite independently certifies every rounded expected value against adjacent representable values, and enumerates the entire positive <4,4> finite set for a separate differential search. Errors and exactness are tested separately. The corpus was not generated by calling reference.py; no observed macOS fixture is the specification.

Important choices requiring approval: the base-3 finite subset versus legacy/raw states; exact-only default and explicit rounded success; range errors before rounding; zero-sign normalization; and a completed nearest-even rule. At a base-3 exponent boundary both candidate mantissas can have the same parity, so this draft adds the smaller-exponent tie rule. This is not implied by saying “IEEE-like.”

The earlier float_conversion_audit/ oracle and native failures remain preserved. The new decoder deliberately rejects spellings such as exponent E00 or E-0 that the audit decoder accepted. The existing integer provenance v2 contract and v1 historical fixtures remain intact. No accepted specification, API, ISA, production source or serializer is changed by this design work.

Local design validation: all seven new reference tests (104 static corpus cases, independent certificates and small-format search comparisons) and all five preserved audit-reference tests passed. Proposal-local links, the determinism claim guard and git diff --check passed. Only draft/reference/navigation/CI files are changed; existing production, ISA, serializers and provenance fixtures are outside this diff. Native workflow results test the Python proposal only.