Skip to content
Joris Gillis edited this page Apr 4, 2023 · 1 revision

Standard documentation for remainder:

 Remainder after division: (x,y) -> remainder(x,y)

::

 remainder(float x, float y) -> float
 remainder(DM x, DM y) -> DM
 remainder(SX x, SX y) -> SX
 remainder(MX x, MX y) -> MX

This Function follows the convention of https://en.cppreference.com/w/c/numeric/math/remainder

Notably: remainder(5,3) -> -1

remainder(5,-3) -> -1

remainder(-5,3) -> 1

remainder(-5,-3) -> 1

This is equivalent to Python's math.remainder. There is no equivalence in Matlab.

\seealso fmod

::

 Extra doc: https://github.com/casadi/casadi/wiki/L_24x 

Doc source: https://github.com/casadi/casadi/blob/develop/casadi/core/generic_expression.hpp#L634

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/generic_expression.hpp#L634-L636

Extra documentation

To edit, see writing tips.

Clone this wiki locally