Is there a way to convert any number to either $1$ or $-1$ depending on its sign?
For example:
13 = 1
-13 = -1
-670.2 = -1
8.22 = 1
Lets say X is the number, i could do X / X and i would always get $1$ but the minus would get lost.
Is there a way to convert any number to either $1$ or $-1$ depending on its sign?
For example:
13 = 1
-13 = -1
-670.2 = -1
8.22 = 1
Lets say X is the number, i could do X / X and i would always get $1$ but the minus would get lost.
I think the usual way would be to use the absolute value:
$$\frac{x}{|x|}.$$
It won't work for $x=0,$ though.
If you don't like absolute value, then you can replace it by $\sqrt{x^2}$.