here cross multiplication is compared instead of division comparison
if ( ( points [ i ] [ 0 ] - points [ first ] [ 0 ] ) * ( points [ second ] [ 1 ] - points [ first ] [ 1 ] ) != ( points [ second ] [ 0 ] - points [ first ] [ 0 ] ) * ( points [ i ] [ 1 ] - points [ first ] [ 1 ] ) and minD > d ) : NEW_LINE INDENT minD = d NEW_LINE third = i NEW_LINE DEDENT print ( points [ first ] [ 0 ] , ' , ▁ ' , points [ first ] [ 1 ] ) NEW_LINE print ( points [ second ] [ 0 ] , ' , ▁ ' , points [ second ] [ 1 ] ) NEW_LINE print ( points [ third ] [ 0 ] , ' , ▁ ' , points [ third ] [ 1 ] ) NEW_LINE