Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix division remainder operator (%) #272

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MeanSquaredError
Copy link
Contributor

This fixes #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.

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.

Incorrect results returned by the remainder operator %
1 participant