Closed matkraj closed 6 years ago
@matkraj I think you should be looking at af.mod
. This behavior is consistent with IEE (check std::remainder)
@pavanky Thanks, I got confused because there is no af.mod in arrayfire-python.
Probably this needs to be added to arrayfire/arith.py
def mod(lhs, rhs):
"""
Find the modulus.
Parameters
----------
lhs : af.Array or scalar
Multi dimensional arrayfire array or a scalar number.
rhs : af.Array or scalar
Multi dimensional arrayfire array or a scalar number.
Returns
--------
out : af.Array
Contains the moduli after dividing each value of lhs` with those in `rhs`.
Note
-------
- Atleast one of `lhs` and `rhs` needs to be af.Array.
- If `lhs` and `rhs` are both af.Array, they must be of same size.
"""
return _arith_binary_func(lhs, rhs, backend.get().af_mod)
@matkraj Do you want to send in a review with this change ?
Hi, I noticed if I calculate reminder function I get:
print(af.rem(af.constant(11,1,1),3))
which should be: