summaryrefslogtreecommitdiff
path: root/awklib/eg/lib/div.awk
blob: 5939024dbcd84bbaf81ff37279a3736ae1320a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# div --- do integer division

#
# Arnold Robbins, arnold@skeeve.com, Public Domain
# July, 2014

function div(numerator, denominator, result)
{
    split("", result)

    numerator = int(numerator)
    denominator = int(denominator)
    result["quotient"] = int(numerator / denominator)
    result["remainder"] = int(numerator % denominator)

    return 0.0
}