[Math] Equation that produces negative one if x is less than zero and vice versa


I have tried coming up with something but i couldn't in the end…

basically i want something to produce -1 or 1. given value of x will not be equal to zero at any point. But if you want to add that, do so in another example. I'd like to have both, but need first one.


if x=2 
if x=-3435

what i've tried:

well i thought i am gonna need a way to make any number a one regardless of sign right.

x-((x*-1)) working on it 😀

can't use square root, absolute value(unless there is a equation for deriving absolute value).

Best Answer

It sounds like you want the sign function. Considering the restriction that $x \neq 0$, you could just write


Related Question