You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The modulus operator mod is currently only defined for scalar, i.e., float quantities. I suggest implementing it for vectorial and tensorial quantities, e.g., vec3, so that we can omit a wrapper function, such as,
The modulus operator mod gives the modulus as defined in C and not in Python, which might lead to surprising behavior if we are unaware. I suggest adding a Pythonic modulus operator, e.g.,
@wp.func
def pymod(a: float, b: float) -> float:
return wp.mod(wp.mod(a, b) + b, b)
Context
The motivation for this request is to have less boilerplate code in our application.
The text was updated successfully, but these errors were encountered:
We just merged the changes to the branch main. So far we only added support for vectors to wp.mod() and documented the built-in as being implemented as a truncated division to alleviate the ambiguity with Python's implementation. We haven't implemented the floored division variant for now.
Description
mod
is currently only defined for scalar, i.e.,float
quantities. I suggest implementing it for vectorial and tensorial quantities, e.g.,vec3
, so that we can omit a wrapper function, such as,mod
gives the modulus as defined inC
and not inPython
, which might lead to surprising behavior if we are unaware. I suggest adding a Pythonic modulus operator, e.g.,Context
The motivation for this request is to have less boilerplate code in our application.
The text was updated successfully, but these errors were encountered: