Mixed Integer Programming - variable that equals the sign of an expression
Let $\epsilon>0$ be a small constant tolerance and impose $$Ly + \epsilon(1-y) \le x - \text{th} \le 0y + U(1-y)$$ Then $y = 1 \implies L \le x-\text{th} \le 0$, and $y = 0 \implies \epsilon \le x - \text{th} \le U$.