Emulating equal operator using multiplication

I have two values $A$ and $B$, I want to know if I can implement the equals $=$ operation as the product of the two values. I can apply any function to $A$ and any function to $B$, but I need to use multiplication at the end.

Basically I want to find $f$ and $g$, such that:

$$f(A) \cdot g(B) = \begin{cases} 1, & A = B \\ 0, & A \ne B \end{cases}$$

For example, if I use $g(x) = 1/x$ I get something close to what I want $$A \cdot 1/B = \begin{cases} 1, & A = B \\ A/B, & A \ne B \end{cases}$$ Is it possible to do that? If so, what are the functions $f$ and $g$ that I should use?

Suppose that $f,g$ were functions satisfying $f(A) g(A) = 1$ and $f(A) g(B) = 0$ if $A \neq B$. Take any $A \neq B$. Then $f(A) g(B) = 0$, and so either $f(A) = 0$ or $g(B) = 0$. If $f(A) = 0$ then $f(A) g(A) = 0$, and if $g(B) = 0$ then $f(B) g(B) = 0$. So no such functions exist.