If you have unit quaternion $q$ then formula $u \to qu\bar q$ define rotation of imaginary quaternion $u$ over axis $Im(q)$ and angle having cosine of half equal to $Re(q)$. The oposite rotation is obtained by conjugate quaternion $\bar q$ giving formula $u \to \bar quq$. If you combine both transformations you obtain $\bar q qu\bar q q$ which is equal to $u$ because $q$ is unit quaternion and multiplication of quaternions is associative.
If you do not obtain the same point after applying rotation $q$ and $\bar q$ then you must have done some mistake. It is hard to know where might be the mistake without seeing your code.
Complex numbers are couples, they have a real part and an imaginay part. Quaternions are hypercomplex numbers, they are also couples of a real part $w$ and an imaginary vector part $b = (x i, y j, z k)$.
Quaternions are tipically parameterized by two parameters: rotation angle $\theta$ and rotation axis (unit vector) $n$. The real part is $w = \cos(\frac{\theta}{2})$ while the vector part is $b = \sin(\frac{\theta}{2}) n$.
Given two qaternions $q_1 = (w_1, b_1)$ and $q_2 = (w_2, b_2)$ their multiplication in vector form is:
$$q_1 q_2 = (w_1, b_1) (w_2,b_2)$$
$$q_1 q_2 = (w_1 w_2 - b_1 \cdot b_2, w_2 b_1 + w_1 b_2 + b_1 \times b_2)$$
After multiplication the new rotation axis is:
$$b_3 = (w_2 b_1 + w_1 b_2 + b_1 \times b_2)$$
$b_3$ has one component in the plane spanned by $b_1$ and $b_2$ ($w_2 b_1 + w_1 b_2$) and one component in the direction orthogonal to that plane ($b_1 \times b_2$).
The case of the SLERP ia a little bit different. Looking at the SLERP formulae:
$$q(t) = \frac{1}{\sin(\frac{\theta}{2})}( \sin((1-t)\frac{\theta}{2}) q_1 + \sin(t \frac{\theta}{2}) q_2)$$
Or
$$q(t) = \frac{1}{\sin(\frac{\theta}{2})}( \sin((1-t)\frac{\theta}{2}) (w_1, b_1) + \sin(t \frac{\theta}{2}) (w_2, b_2))$$
Where $\theta = 2 \cos^{-1}(n_1 \cdot n_2)$ is the angle formed between the axis of rotation of $q_1$ and $q_2$. So the interpolated axis of rotation is:
$$b_t = \frac{1}{\sin(\frac{\theta}{2})}( \sin((1-t)\frac{\theta}{2}) b_1 + \sin(t \frac{\theta}{2}) b_2)$$
Which is in the plane spanned by $b_1$ and $b_2$ (in between $b_1$ and $b_2$ to be precise), the expected behavior of SLERP.
Best Answer
The map from unit quaternions to $3\times3$ rotation matrices is a double cover. Both $q,-q\in\mathcal{S}^1(\mathbb{H})$ map to the same rotation matrix. As such, the inverse map rot2quad should be set valued. Here, they can recover $|\cos\theta/2|$ from the constraint $|q|=1$, but they do lose the sign of $\theta$. This could cause problems because then quad2rot(rot2quad($R$)) yields two possible answers $R_1$ and $R_2$, and only one of them equals $R$. This problem is not due to the double cover, but rather the omission of the real part. Perhaps they only need the pure quaternion part for whatever it is they do.