Skip to content

[tmva][sofie] fix: correct Mod/FMod Func() constant-folding, add regression test#21735

Open
harz05 wants to merge 1 commit intoroot-project:masterfrom
harz05:fix/sofie-modfmod-func
Open

[tmva][sofie] fix: correct Mod/FMod Func() constant-folding, add regression test#21735
harz05 wants to merge 1 commit intoroot-project:masterfrom
harz05:fix/sofie-modfmod-func

Conversation

@harz05
Copy link
Copy Markdown
Contributor

@harz05 harz05 commented Mar 29, 2026

Changes:

In tmva/sofie/inc/TMVA/ROperator_BasicBinary.hxx, the Func() method for the Mod and FMod traits was calling std::pow(t1, t2) instead of the correct modulo operation. Func() is used during constant-folding when both inputs to a Mod/FMod node are ONNX Constant nodes, producing completely wrong output silently.

  • Mod::Func fixed to return t1 % t2
  • FMod::Func fixed to return std::fmod(t1, t2);

I've also included a regression test FMod_ConstantFolding that exercises exactly this code path.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #21734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tmva][sofie] Mod/FMod constant-folding uses std::pow instead of modulo

3 participants