Fix precedences and the evaluation algorithm

First part of this patch fixes https://github.com/hoaproject/Math/issues/4.