Replacement for @raoulb pr#914

See #914

ToDo:
- [x] tests
- [x] final rebase
"is a some" is not good grammar, but I know what you mean (not all rational multiples of pi are supported). How about "and for some instances when the result is a rational multiple of pi".