rotateUz looks fishy

I found out the equation behind the scenes:

C = A x B

A = 
u1/up  -u2/up 0
u2/up   u1/up 0
0       0     1

B =
u3  0 up
0   1 0
-up 0 u3

But up is always a positive number (theta is in 0, pi, as you said). So the sign of u1 and u2 is totally ignored for creating the B rotation (not for A).

In the case of u1=0, I do not see clearly if this rotation makes sense. (Why should it be rotated around y-axis?)

In the case of u2=0, and u1<0, A becomes a rotation by pi but B stays the same independently of u1<0 or u1>0, ie B is rotating in the ‘wrong sense’ of the y-axis right-hand rule.