least-square endpoints