Unit tests and bugfixes for type checking.
Prevent 2*PI and 0 radians getting mixed up.