Repository navigation
det: COMP-1/COMP-2 as IBM hexadecimal floating point; COMP-5 VALUE image (#4271 slice 1) - #4571
Merged
Merged
Conversation
…image (#4271 slice 1, #4501) The det runtime models HFP (cobolrt/Hfp, Field.hfp): big-endian storage, ADD / SUBTRACT with one guard digit, truncating MULTIPLY / DIVIDE, LOAD ROUNDED long to short, IBM's float-to-fixed rounding (9 / 18 significant digits) and DISPLAY as external floating point. The translator picks each statement's mode by IBM's Appendix A rule (fixed, short, long), compares in floating point, encodes float VALUEs with det/hfp.py, and refuses by name what GnuCOBOL (IEEE, decimal evaluation) cannot decide: a float's bytes or those of an item over it, float exponentiation and functions, SIZE ERROR / ROUNDED / REMAINDER in float mode. Proof: IBM-cited byte vectors, the runtime against det/hfp.py bit for bit, and a FLOAT program equal to GnuCOBOL on exact values in bytes, typed and groups modes. #4501: a COMP-5 VALUE was written truncated to its PICTURE and big-endian while the runtime reads COMP-5 little-endian (32767 read back as -12534); the image now holds the whole value in the runtime's order (COMP5 program, against GnuCOBOL). Part of #4271 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR
…verloads, #4558) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR
…compareAll) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017BVJCCUMdjLJq1TAM3V34V
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #4271 (slice 1: COMP-1 / COMP-2). Fixes the value bug of #4501 (see below for why it is not auto-closed).
What
The det translator and runtime now model COMP-1 / COMP-2 as IBM hexadecimal floating point (HFP). Before, every statement that named a float was a Hole.
cobolrt/Hfp.java,Field.hfp, float branches inCobol/Codec):-.9(8)E-99,-.9(17)E-99).gen.py): each statement gets IBM's evaluation mode (Appendix A): fixed point, short (all COMP-1, no multiplication) or long. Comparisons are done in floating point. VALUE clauses are encoded bydet/hfp.py, the translator's own HFP model.oracle_assumptions.md C6): anything the oracle cannot decide.How the oracle comparison works
GnuCOBOL stores IEEE floats and evaluates float expressions in truncated decimal, so it cannot decide HFP. The slice is proven three ways (
test_det_hfp.py,test_det_programs.py):41100000, -118.625 =C276A000, 0.1 =4019999A, the range ends7FFFFFFFand00100000, and the guard digit ("1 - 16**-8 = 1"). The rounding rules and the DISPLAY form are checked the same way.FLOATprogram (every MOVE direction, the four verbs with and without GIVING, COMPUTE, IF / 88 / THRU / EVALUATE / sign conditions, SET TO TRUE, PERFORM VARYING, INITIALIZE of a group holding a float) matches GnuCOBOL in bytes, typed and typed-groups modes (the typed-mode equivalence).While writing (3) I found that GnuCOBOL 3.1.2 gets some float expressions wrong.
COMPUTE L2 = (L1 - N3) / N4gives 0.L1 / N4 + S1 * 2drops the second term.IF S1 + 1 > 2is false for S1 = 6.25. This is recorded in register C6 as places where the oracle decides nothing.ASSUMED, because IBM does not document it (register C6): the fixed-to-float conversion (truncated to long, then rounded to short), DISPLAY mantissa rounding, and truncation when a float result is stored in a fixed receiver without ROUNDED.
#4501 (COMP-5 VALUE)
layout.encode_numberwrote a COMP-5 VALUE truncated to its PICTURE and big-endian, while the runtime reads COMP-5 little-endian. SoS9(4) COMP-5 VALUE 32767read back as -12534 (2767 byte-swapped). The image now holds the whole value in the runtime's (GnuCOBOL's) order. The newCOMP5program matches GnuCOBOL in all three modes; before the fix it gave -12534 / 12533 / 40725 / -9713144.The CAXA det port proof:
port_runner run --backend detfor CAXA and CAXB on the case's generated project, thencics_crucible.py --cases ca-xctl-versions --sides java-portedat the v0.3.0 pin.length-rangefailed with "length 32767 expected, got -12534".length-rangeis unsupported, not failing: "CicsTask: commarea bytes past what its DTO holds". The det XCTL passes WS-BIG (32767 bytes) through CAXB's 80-byte DTO. That is the CicsTask event model: SEND TEXT length/options, RECEIVE-MAP event, COMMAREA length (Java side, 28+ cells) #4009 harness/boundary limit, not the COMP-5 bug.So #4501's first acceptance item is met and its second ("length-range passes") is not. I have left the issue open for the orchestrator to close or retitle.
Left for later slices of #4271 (unchanged, register C5 / C7)
NUMPROC(PFD)with non-preferred signs: refused by name.ARITH(EXTEND),TRUNC(OPT),INTDATE(LILIAN): detected from CBL / PROCESS cards and refused (UnsupportedOption).mortgage-mpmtstays in the det sweep baseline with an updated reason. Its interest COMPUTE now translates, but the payment's(1 + C) ** N(N with decimal places) is a float exponentiation, the one hole.Gates
Run on the branch after merging origin/main (#4560, #4563, #4567, #4564):
pr_gates.py7/7 pass (lint, audits, secrets, xray, gauntlet, golden, suite);--ratchets6/6 pass; det tests 419 pass with EQUIVALENCE_E2E=1 (JDK 17 + docker);proof_sweep.py --det-only --skip-db2"as expected". Milestone not set (the milestone PATCH is blocked for the agent).🤖 Generated with Claude Code
https://claude.ai/code/session_017BVJCCUMdjLJq1TAM3V34V