Stochastic rounding: implementation, error analysis and applications