@certik Builtin % in LPython doesn't work on arrays by default because it is implemented as a function and not a binop. So the question is which approach to follow,
- To make
_mod function defined in lpython_builtin.py vectorised;
- Define
Mod as binop and then use builder->CreateSRem in LLVM backend. Note that not all backends might support modulus operation on types other than integers.
- Define
mod and then make it vectorisable.
I think 3rd approach is a good one and complies with Python and NumPy standards. What do you say @certik?
Originally posted by @czgdp1807 in #1002 (comment)
@certik Builtin
%in LPython doesn't work on arrays by default because it is implemented as a function and not abinop. So the question is which approach to follow,_modfunction defined inlpython_builtin.pyvectorised;Modasbinopand then usebuilder->CreateSRemin LLVM backend. Note that not all backends might support modulus operation on types other than integers.modand then make it vectorisable.I think 3rd approach is a good one and complies with Python and NumPy standards. What do you say @certik?
Originally posted by @czgdp1807 in #1002 (comment)