Replacement for @raoulb pr#914

See #914

ToDo:
- [x] tests
- [x] final rebase
Could use `self.func` here as in the `tan` case.