Erlang intervals library borrowed from scalaris project.