find shared constant in two expressions



Hello,

I have written a simple function separable(expr,x,y) to test if expr is separable, i.e. expr can be written as f(x)*g(y).
However, the algorithm sometimes leads to the introduction of constants like f(x)/C and C*g(x).
example:
(%i2) L:separable(x*log(x)*g(y),x,y);
                 x log(x)                2
(%o2)/R/  [---------, 4 g(y) log (2)]
                     2
              4 log (2)


so even though xlog(x)*g(y) is separated correctly into xlog(x) and g(y), it introduces the constant 4*log^2(2).
Is there a simple way to find out if two expressions have a shared constant factor so I can eliminate the constant C?