So losing precision is generally unavoidable if youyou're using limited precision numbers like float or double. However, there is still hope. One strategy to help prevent the repeated inversions getting worse and worse is to re-normalize the quaternion after each inversion (or after a few of them if you can tolerate more error).