1.numerically stable

2.normalize p

3.smoothing