Mann-Whitney U Test results

#1
I am considering the use of the Mann-Whitney U Test to relate two sets of independent samples. I'm using a routine that is already provided in the programming language I'm using.

My question: I get two computed output values (e.g., Ux and Uy), of which I select the smaller and compare this to my chosen significance level. However, when testing the implementation of this routine, sometimes one of the outputs is a negative value. I don't recall seeing this possibility in my textbooks, and I'm not sure if it is meaningful, or how to interpret it if it *is*.

I've just been using randomized data (e.g. between zero and one, or zero and ten) just to see if I can call the routine correctly - could that have anything to do with this?

Note: Ux=(Nx*Ny)+.5*(Nx(Nx+1))-Wx, where Nx and Ny are the number of elements in x and y, and Wx is the rank sum for the x array. Similar for the y array.