Extra math function for Erlang