Skip to content

Update the vendored BNGsim expression layer to 4361958 - #120

Merged
wshlavacek merged 1 commit into
mainfrom
vendor/bngsim-expr-4361958
Oct 23, 2026
Merged

wshlavacek merged 1 commit into
mainfrom
vendor/bngsim-expr-4361958

Conversation

@wshlavacek

Copy link
Copy Markdown
Collaborator

This is a prerequisite for vendoring 3.12.0 into BNGsim. bngsim/scripts/vendor_rulemonkey.py refuses to vendor RuleMonkey while third_party/bngsim_expr differs from BNGsim's own expression layer (EXPRTK_SYNC_FILES, RELEASING.md step 7). That layer has moved since PR #100 pinned it at 6ce2276; this re-pins it to BNGsim main at 4361958.

What moves

BNGsim change What it does Effect on RuleMonkey
lanl/bngsim#768, lanl/bngsim#1080 mratio() stops trusting Gauss's continued fraction where it converges to a false limit or loses digits. It sums a = 0 exactly, sums both Kummer series inside |z| <= 20 and in the corner a <= 0, z < -20, b - a < 1, takes the fraction's second step as exactly 1, and refuses b <= 0 where nothing can vouch for the answer. Standalone mratio(0, 1, 100) was 1.282e15 on main for (e^100 - 1)/100 = 2.688e41, and is 2.688e41 now. mratio(0, 0.5, 40) was -4.09e15 and is 3.30e16. mratio(1, 2, 3) and mratio(-3, 1, 5) are unchanged. Measured with a probe compiled against both copies.
lanl/bngsim#772 define_function() throws when the symbol table refuses a name. RuleMonkey does not call it.
lanl/bngsim#919, a5c957d ExpressionEvaluator gains try_define_variable(). A name define_variable() refuses because it is not an identifier is now reported as such, not as a duplicate. RuleMonkey does not subclass ExpressionEvaluator, and no test pins the old message.

exprtk.hpp and expr_compat.hpp are unchanged. Inside a BNGsim build nothing changes: CMake links the host bngsim::expression target and this copy is not compiled, so the vendored 3.11.0 already runs on this layer there.

Blast radius (standalone)

rm_driver --print-functions stdout and exit code match main byte for byte on all 262 XMLs under tests/, two seeds each, run from t = 0 and from --t-start 5. No model under tests/ calls mratio(), so the corpus cannot see the fix.

Refreshed with scripts/vendor_exprtk.py, which also rewrote VENDOR and VENDOR.json. Not changelogged, as RELEASING.md says for a contents refresh (#58, #78, #100).

Verified: ctest 67/67, harness/basicmodels.py 29/29, scripts/vendor_exprtk.py --check OK. pre-commit skips third_party/ by design.

The copy under third_party/bngsim_expr was pinned to BNGsim 6ce2276
(PR #100).  Later BNGsim commits change expression.hpp and
expression.cpp:

- mratio() (lanl/bngsim#768, lanl/bngsim#1080).  It trusted Gauss's
  continued fraction in regions where the fraction converges to a false
  limit or loses digits.  It now sums a = 0 exactly, sums both Kummer
  series inside |z| <= 20 and in the corner a <= 0, z < -20, b - a < 1,
  takes the fraction's second step as exactly 1 so that a tiny b no
  longer leaks through, and refuses b <= 0 where nothing it has can
  vouch for the answer.  Through RuleMonkey's standalone evaluator,
  mratio(0, 1, 100) was 1.282e15 on main for (e^100 - 1)/100 = 2.688e41,
  and is 2.688e41 now; mratio(0, 0.5, 40) was -4.09e15 and is 3.30e16.
  mratio(1, 2, 3) and mratio(-3, 1, 5) are unchanged.
- define_function() throws when the symbol table refuses a name
  (lanl/bngsim#772).  RuleMonkey does not call it.
- ExpressionEvaluator gains try_define_variable() (lanl/bngsim#919),
  and a name define_variable() refuses for not being an identifier is
  now reported as such, not as a duplicate (a5c957d).  RuleMonkey does
  not subclass ExpressionEvaluator, and no test pins the old message.

bngsim's vendor_rulemonkey.py refuses to vendor RuleMonkey while this
copy differs from bngsim's own (EXPRTK_SYNC_FILES), so the next
release can be vendored only once this lands.  Inside a BNGsim build
nothing changes, because CMake links the host bngsim::expression
target and this copy is not compiled; vendored 3.11.0 already runs on
this layer there.

Standalone, rm_driver --print-functions output and exit code match main
byte for byte on all 262 XMLs under tests/, two seeds each, run from
t = 0 and from --t-start 5.  No model under tests/ calls mratio(), so
the corpus cannot see the fix; the numbers above are from a probe
compiled against both copies.

Refreshed with scripts/vendor_exprtk.py, which also rewrote VENDOR and
VENDOR.json.  exprtk.hpp and expr_compat.hpp are unchanged.  Not
changelogged, as RELEASING.md says for a contents refresh.

Verified: ctest 67/67, harness/basicmodels.py 29/29,
scripts/vendor_exprtk.py --check OK.
@wshlavacek
wshlavacek merged commit 51ffd07 into main Oct 23, 2026
10 checks passed
@wshlavacek
wshlavacek deleted the vendor/bngsim-expr-4361958 branch October 23, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant