The general formula for the magnetic moment of a charge configuration is defined as $$\vec{\mu} = \frac{1}{2} \int \vec{r} \times \vec{J} \,d^3r$$ For an electron it's said that the correct equation relating it's spin and magnetic moment is is $$\vec{\mu} =g\frac{q}{2m}\vec{S}$$ It's said tha...