Simulate the behaviour of erlang:'div'/2