The angle of the rotation that takes a to b, in radians within [0, π]: the geodesic distance between the two rotations. q and -q are the same rotation, so negating either argument changes nothing.
The angle is 2 atan2(|v|, |w|) of inverse(a) * b. The shorter 2 acos |a · b| reads an angle from a cosine's deficit from 1, which binary64 resolves only to about 1.1e-16: angles below about 3e-8 radian collapse to 0 or a few steps that size. The relative vector part keeps full relative precision, which candidate ranking needs for mirrored inputs.
The angle of the rotation that takes
atob, in radians within[0, π]: the geodesic distance between the two rotations.qand-qare the same rotation, so negating either argument changes nothing.The angle is
2 atan2(|v|, |w|)ofinverse(a) * b. The shorter2 acos |a · b|reads an angle from a cosine's deficit from 1, which binary64 resolves only to about 1.1e-16: angles below about 3e-8 radian collapse to 0 or a few steps that size. The relative vector part keeps full relative precision, which candidate ranking needs for mirrored inputs.