Skip to content
Joris Gillis edited this page Apr 4, 2023 · 3 revisions

Standard documentation for fmod:

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

::

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

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

Notably: fmod(5,3) -> 2

fmod(5,-3) -> 2

fmod(-5,3) -> -2

fmod(-5,-3) -> -2

This is equivalent to Python's numpy.fmod and Matlab's rem.

\seealso remainder

::

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

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

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/generic_expression.hpp#L613-L615

Extra documentation

To edit, see writing tips.

Clone this wiki locally