The only difference between the two, AFAICS is when a = 180 -> -180 vs the original keeping the sign, but I'd be happy to put in a special case for that anyway - it would still be more elegant than my original.