Jinja2Cpp
Jinja2Cpp copied to clipboard
Fix division remainder operator (%)
This fixes https://github.com/jinja2cpp/Jinja2Cpp/issues/271
Jinja2Cpp's %
operator differs from %
of the original Jinja library.
For example the expression {{ 11 % 7 }} in Jinja2Cpp shows -3
, while the original Jinja shows 4
.
Here is a link to the documentation of the original Jinja: % Calculate the remainder of division. For instance, 11 % 7 returns 4.
The reason why Jinja2Cpp differs from the original Jinja is because Jinja2Cpp uses std::remainder
instead of std::fmod
.
This PR replaces std::remainder
with std::fmod
, adds a test for the %
operator and also fixes a typo in the name of the DivReminder
variable by renaming it to DivRemainder
.