Repository navigation
det: FUNCTION NUMVAL in a floating-point expression as IBM's long HFP -- CBSA BNK1CAC / BNK1TFN / BNK1UAC whole (Part of #4270) - #4742
Merged
Conversation
…'s long HFP (Part of #4270) IBM: NUMVAL returns "a floating-point approximation of the numeric value represented by argument-1" (6.4 Language Reference, NUMVAL); NUMVAL, NUMVAL-C and NUMVAL-F "return long (64-bit) floating-point values in compatibility mode" (6.4 Programming Guide, "Converting to numbers"). The det runtime now makes NUMVAL a long HFP operand (Hfp.numval): the statement is long, a COMP-1 receiver rounds to short. Refused by name at run time: an argument past 18 digits (invalid under ARITH(COMPAT)) and a value past 15 significant digits (IBM: precision lost "in an unexpected manner"). ARITH(EXTEND), from the options resolver (program.arith_extend), refuses every floating-point expression: extended-precision HFP is not modelled. CBSA BNK1CAC, BNK1TFN and BNK1UAC now translate whole (census 82 -> 85 / 125); BNK1CRA keeps EXEC CICS INQUIRE. Register C6 declares where the oracle differs (inexact values: GnuCOBOL truncates a float MOVEd to fixed point). #4741 follows up NUMVAL in a fixed-point COMPUTE. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D
Contributor
squid-protocol
marked this pull request as ready for review
October 9, 2026 03:13
This was referenced Oct 9, 2026
Merged
squid-protocol
added a commit
that referenced
this pull request
Oct 9, 2026
…e checked (Fixes #4741) (#4759) * det: FUNCTION NUMVAL / NUMVAL-C in a fixed-point COMPUTE as IBM's long HFP, its store checked (Fixes #4741) IBM evaluates an arithmetic statement with a numeric-function operand in floating point (6.4 Programming Guide SC27-8714-03, "Floating-point evaluations", p. 62), and NUMVAL / NUMVAL-C return long floating point (p. 115; Language Reference SC27-8713-03, p. 605). The det translator now makes such a statement a long HFP one (Hfp.numval: the same refusals as #4742 for more than 18 digits and more than 15 significant digits). IBM documents the float-to-fixed MOVE (rounded) but not an arithmetic statement's store, so Hfp.fixedStore refuses by name a value the documented and the assumed (truncated unless ROUNDED) rules store differently, e.g. NUMVAL('0.10') = 0.0999... into 9V99; values exact at the receiver's scale store as they are and agree with the oracle (NUMVALX, in three modes). A proven case with such values declares "numval_fixed_store": "oracle" (a declared difference of its evidence record, #4051): CardDemo COTRN02C (carddemo-tranadd) needs it for an amount like 123.45 and a 16-digit card number. Register C6 records the semantics, the refusals and the oracle difference. Census: 108 / 179 programs whole before and after. Also fixes det_survey's NameError (ispf_screens) when an estate fails to generate. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D * det: refresh the coverage ledger for carddemo-tranadd (its case declares the NUMVAL store, #4741) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D * carddemo-tranadd: the invalid-card scenario uses a 15-digit value; re-prove the record and ledger (#4741) NUMVAL of 9999999999999999 (16 significant digits) is undefined on z/OS (long HFP keeps 15) and refused by name; the scenario's card is now 0999999999999999, still absent from the cross-reference (same 18/18 paragraphs, 72/75 branches). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D * det: re-prove carddemo-tranadd and refresh the coverage ledger after merging main (#4741) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D * det sweep ledger: re-measured the 4 ports #4741 moves after the main merge Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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 #4270. Makes CBSA's BNK1CAC, BNK1TFN and BNK1UAC translate whole: their only gap was
COMPUTE <COMP-1 / COMP-2> = FUNCTION NUMVAL(...), refused as "FUNCTION NUMVAL in a floating-point expression (oracle_assumptions.md C6)". BNK1CRA loses the same two holes and keepsEXEC CICS INQUIRE.IBM semantics modelled (register C6)
Hfp.numval): the statement is long (IBM, Appendix A p. 800: short only if all receivers and operands are COMP-1 items), and a COMP-1 receiver rounds the long result to short (LOAD ROUNDED, already modelled). A float MOVEd on to fixed point rounds, as already modelled.program.arith_extend, the sameeffective_with_defaultsas TRUNC and NUMPROC). Under ARITH(EXTEND), every floating-point expression is refused by name, because extended-precision HFP is not modelled. CBSA is COMPAT (IBM default; no card sets ARITH).Where the oracle differs (declared in C6)
GnuCOBOL computes NUMVAL in decimal, stores the nearest IEEE float, and truncates a float MOVEd to fixed point. Measured on cobc 3.1.2 (2026-10-08):
NUMVAL('0.7')into a COMP-1, then to9(4)V99: cobc gives 0.69; det (IBM rounding) gives 0.70.NUMVAL('12.34')into a COMP-2, then to9(10)V99: cobc gives 12.33; det gives 12.34.The two agree only on values exact in both formats, such as 1.5, 2.25 or 100.50. No CBSA case runs these programs yet.
Proof
test_det_programs.pyNUMVALF vs cobc (EQUIVALENCE_E2E=1), bytes / typed / groups modes, all pass. It covers the CBSA shapes: a COMP-1 and a COMP-2 receiver, aAMTI(1:AMTL)argument, a leading sign, a trailing CR, NUMVAL-C with$and commas, zero, two NUMVALs added, a NUMVAL comparand, and the< 0/> 9999.99/= ZEROtests and MOVEs to fixed point that follow. FLOAT, DPCOMMA, SORTCS and SORTPC also pass (15/15).test_det_hfp.py: Hfp.numval against the model (0.1gives long4019999999999999, short4019999A), the two run-time refusals, the ARITH(EXTEND) refusal from a PROCESS card, and the hole test now uses SQRT. 39 passed.det_port.py checkvs origin/main: 78/79 ports unchanged. Only mortgage-mpmt changed (its copy of Hfp.java).proof_sweep.py --det-only --cases mortgage-mpmt: "as expected" (KNOWN_UNPROVEN: its float exponentiation).cics_census.py blockers, CICS programs): whole programs went from 82 to 85 of 125: BNK1CAC (387 to 389 of 389 statements), BNK1TFN (347 to 349 of 349), BNK1UAC (439 to 441 of 441). The NUMVAL gap row is gone. No other program changed, burned or non-burned.evidence.py status --ci: no blocking stale record.pr_gates.py --fast: 5/5 pass.--ratchets: 7/7 pass.Follow-up: #4741. NUMVAL in a fixed-point COMPUTE is still computed as an exact decimal, but IBM evaluates it in long HFP too.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D