How it works

The Instruction operation "divide" can be used to divide numerical inputs. Divide is performed over the inputs accumulatively first to last: each subsequent input is divided from the result of the previous input calculation. The division operation works with decimals and integers.

  1. Divide by zero will return the string "inf"
  2. Failed divisions will return "NaN" Not a Number

"Divide" Examples

Example 1: Integer Division and Multiplication

This example shows a simple integer division, so we have (36 / 3) / 2 = 6.

<instruction operation="divide">
	<input value="36" />
	<input value="3" />
	<input value="2" />
</instruction>
6

Example 2: Decimal Division, integer result

This example uses precision "0" by default, so the answer is an integer. Note it is rounded DOWN

<instruction operation="divide">
	<input value="5" />
	<input value="2" />
</instruction>
2

Example 3: Decimal Division, decimal result

The same divide, but this time we allow for a decimal place.

<instruction operation="divide" precision="1">
	<input value="5" />
	<input value="2" />
</instruction>
2.5

"Divide/Multiply" Examples

Example 1: Division and Result Multiplication

This example shows a simple integer division and its result is then multiplied, so we have (6 / 3) * 5 = 15.

<instruction xmlns="http://www.obyx.org">
            <input>
                    <instruction operation="multiply">
                        <input value="5" />
                        <input>
                            <instruction operation="divide">
                                <input value="6" />
                                <input value="3" />
                            </instruction>
                        </input>
                    </instruction>
            </input>
</instruction>

10



Last Modified: Thu, 15 Jan 2015