COSMO: Computing with Stochastic Numbers in Memory