rebased calculation on RPN