Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions > Mathematical and Numeric Functions

QUANTUM(A,B) QUANTize A by B

Scroll Prev Top Next More

Truncates A to the integer multiple of B that lies nearest to zero. For positive numbers, returns the number smaller than or equal to A that is an integer multiple of B: (B  *  integer part of(A/B)).  A common use of QUANTUM is to remove the non-integer part of a value (e.g., QUANTUM(3.456,1.0) is equal to 3.0).  If B is less than or equal to zero, then A is returned.

Units: QUANTUM(unit,unit) --> unit (both arguments have the same units)

Examples

QUANTUM(1.9,1.0) is equal to 1.0.

QUANTUM(0.9,1.0) is equal to 0.0.

QUANTUM(-0.9,1.0) is equal to 0.0 (note behavior around 0.0).

QUANTUM(-1.9,1.0) = -1.0.

QUANTUM(A,B) is equal to -QUANTUM(-A,B) (the general rule).

QUANTUM(112.3,10.0) is equal to 110.0.

QUANTUM(50,12) is equal to 48.0.

QUANTUM(423, 63) is equal to 378 (378 = 6 * 63).

QUANTUM(X,0) is equal to X.

 

See also: INTEGER, MODULO

Sample model: QUANTUM.mdl in FunctionExamples