The Bayesian detection of discontinuities in a polynomial regression and its application to the cycle-slip problem