The least squares method is widely used in statistics with common application to regression. The aim is to fit a linear function to set of points that minimizes the sum of the squares of the residuals. In some cases, fitting a linear function with a relatively small error is impossible. Keeping the linear character of approximation, the data points can be split into a sequence of segments, where to each of the segments the line given by a linear function is fitted. The optimization objectives for this problem is to minimize the total least squares error for all segments and to minimize the number of segments used. We refer to such a problem as segmented least squares.