smallest distance between angles (bug fix)