Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions > Mathematical and Numeric Functions

MODULO(A,B) MODULO of A relative to B

Scroll Prev Top Next More

Returns the remainder when A is divided by B.  

Same as A-QUANTUM(A,B).

 
Note : Implementation of the MODULO function in Vensim follows the C standard obeying (a/b)b + a%b = a. Other programming languages (including Excel and Python) have different behavior. The table at the following address provides more information

https://torstencurdt.com/tech/posts/modulo-of-negative-numbers/

 

Units: MODULO(unit, unit) --> unit (all arguments must have the same units)

Examples

MODULO(9,5) is equal to 4.0.

MODULO(76.5,70) is equal to 6.5.

MODULO(8.3,7.3) is equal to 1.0

See also: QUANTUM, INTEGER

Sample model: MODULO.mdl in FunctionExamples