# Function Reference

# _Div

Performs the integer division operation

#include <Math.au3>
_Div ( $iNum1, $iNum2 )

## Parameters

$iNum1 | The integer to be divided.
$iNum2 | The integer divisor.

## Return Value

Success: | the integer result of $iNum1 divided by $iNum2. @extended is set to the integer reminder.
Failure: | Set @error when $iNum2 is 0.

## Remarks

Both operands are converted to integer.
@extended is set to the integer reminder Mod($iNum1, $iNum2).
As @extended cannot be set to a double, see the example to get remainder = -nan(ind) when $iNum2 = 0;

## Related

Mod

## Example

    #include <Math.au3>

    Local $a = [ _
            [-11, -2], _
            [-11, 2], _
            [11, -2], _
            [11, 2], _
            [10, 3], _
            [10, -3], _
            [10.1, -3.9], _
            [10, 0], _
            [0, 0] _
            ]

    ConsoleWrite("Integer division" & @TAB & "Integer remainder" & @TAB & "@extended" & @CRLF)

    Local $n, $d, $q, $r
    For $i = 0 To UBound($a) - 1
        $n = $a[$i][0]
        $d = $a[$i][1]
        $q = _Div($n, $d)
        If @error Then
            $r = 0 / 0 ; as @extended cannot be set to a double
        Else
            $r = @extended
        EndIf

        ConsoleWrite($n & "/" & $d & " = " & $q & @TAB & @TAB & $r & @TAB & @TAB & @TAB & @extended & @CRLF)
    Next