====== DIV Box Function ====== **Divide** Category: [[en-us_products:mpino_studio2:box_functions:arithmetic|Arithmetic Box Functions]] ===== Behavior ===== Divides the first value by the second and stores the quotient. With integer operands, the fractional part is discarded. ===== Syntax and Arguments ===== **Syntax:** ''DIV D0 D1 D2'' * 1st = S1: address or constant (dividend) * 2nd = S2: address or constant (divisor, must not be 0) * 3rd = D: quotient destination address ===== Behavior Example ===== ^ Run condition ^ Before ^ Command entered ^ Expected result ^ | Left condition ON | D0=12, D1=5 | ''DIV D0 D1 D2'' | D2=2 | {{ :en-us_products:mpino_studio2:arithmetic-examples.svg?1000 |Inputs and results for Arithmetic Box Functions }} ===== Cautions ===== * Make sure the result stays within the value range of the destination memory. * Do not use zero as the second source. Division between integers discards the fractional part. ===== Box Functions in the Same Category ===== * [[en-us_products:mpino_studio2:box_functions:arithmetic:add|ADD View details]] — Add * [[en-us_products:mpino_studio2:box_functions:arithmetic:sub|SUB View details]] — Subtract * [[en-us_products:mpino_studio2:box_functions:arithmetic:mul|MUL View details]] — Multiply * [[en-us_products:mpino_studio2:box_functions:arithmetic:mod|MOD View details]] — Modulo * [[en-us_products:mpino_studio2:box_functions:arithmetic:inc|INC View details]] — Increment * [[en-us_products:mpino_studio2:box_functions:arithmetic:dec|DEC View details]] — Decrement * [[en-us_products:mpino_studio2:box_functions:arithmetic:scale|SCALE View details]] — Scale (Linear Interpolation) * [[en-us_products:mpino_studio2:box_functions:arithmetic:floor|FLOOR View details]] — Floor * [[en-us_products:mpino_studio2:box_functions:arithmetic:sqrt|SQRT View details]] — Square Root