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

education

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.

so

if x=2
y=1
if x=-3435
y=-1


what i've tried:

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

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

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

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