shell/math: explain the logic, small tweak to make code smaller