# encoding: ascii
# api: powershell
# title: divide integer
# description: powershell does all dividing by doubles, even integers, so often to simulate a interger division you have to [math]::floor the quotient. Here are some functions to do pure integer division
# version: 0.1
# type: function
# author: karl prosser
# license: CC0
# function: divide-integer
# x-poshcode-id: 869
# x-archived: 2015-04-16T00:33:52
# x-published: 2009-02-12T23:08:00
#
#
function divide-integer ([int]$dividend , [int]$divisor ){ [int]$local:remainder = $Null;return [Math]::DivRem($dividend,$divisor,[ref]$local:remainder);}
set-alias i/ divide-integer

i/ 10 3

function divide-integerpipe ([int]$divisor )
{ begin { [int]$local:remainder = $Null}
  process { [Math]::DivRem($_ ,$divisor,[ref]$local:remainder); }
}
set-alias i\ divide-integerpipe
10 | i\ 3

1..10 | i\ 3
