add erlang equivalent to arith.c