# Extract binary value from continuous variable [duplicate]

I have a continuous variable $$c$$ which has value in between $$[-R, +R]$$.

I want to create a boolean variable $$x$$ and,

$$x = 1$$ when $$c = 1.0$$ otherwise $$x = 0$$

In more general form:

$$x = 1$$ when $$c \in [-k, +k]$$ otherwise $$x = 0$$ here $$[-k, +k]$$ is a new range inside $$[-R, +R]$$