Source: https://education.ti.com/sites/FRANCE/downloads/pdf/2.Fonctions_distance_d'arret.pdf