You can, but I don't think you should.
The argument is the same as for complex numbers. Given the two quaternions, they are equal or not, there is no way to say which one is larger than the other. Quaternions form a division algebra that is not ordered (in contrast to the field of real numbers, for example). The only (reasonable) way I can think of, compare two quaternions is to use the norm.
double norm = Math.sqrt(s*s + i*i + j*j + k*k);
In this case, you can determine that quaternion a is larger than quaternion b if norm a is greater than norm b. But this is definitely not a standard definition. I would be careful in comparing quaternions or complex numbers. However, it depends on your use case. Just keep in mind that there is no standard way to sort such numbers.
See google search for some good links on comparing complex numbers. The argument for quaternions is basically the same.
Another way to compare quaternions is to use the lexicographic order .
source share