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

Modulo: Python vs C++ #1219

Open
havogt opened this issue Mar 23, 2023 · 1 comment
Open

Modulo: Python vs C++ #1219

havogt opened this issue Mar 23, 2023 · 1 comment
Labels
gt4py.next Issues concerning the new version with support for non-cartesian grids. module: backend Related to analysis/backend subpackages triage: bug Something isn't working

Comments

@havogt
Copy link
Contributor

havogt commented Mar 23, 2023

-1 % 2 == -1 in C++, but -1 % 2 == 1 in Python.

In gt4py.next we get different result for C++ and Python backends.

  • check what cartesian does
  • maybe just wrap in abs
@havogt havogt added triage: bug Something isn't working module: backend Related to analysis/backend subpackages gt4py.next Issues concerning the new version with support for non-cartesian grids. labels Mar 23, 2023
@egparedes
Copy link
Contributor

Just for information, math.fmod() implements the same behavior as C/C++ and according to the documentation (https://devdocs.io/python~3.11/library/math#math.fmod) is preferred when working with floats, but the default implementation of operator.__mod__() in python works differently, so it's not so clear to me how to proceed for the embedded backends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gt4py.next Issues concerning the new version with support for non-cartesian grids. module: backend Related to analysis/backend subpackages triage: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants