One issue is that in the statement s.pop() - s.pop()
(and similarly in division), there is no guarantee which s.pop()
is called first. As such, the order that things are removed from the stack isn't consistent. You should do it as two separate calls.
auto oper1 = s.pop();
auto oper2 = s.pop();
s.push(oper1-oper2);
Your erroneous results are due to those two operations being performed in the wrong order, in your case.