More dph optimization

Have added a couple more optimizations as discussed on IRC including the optimization to x * (1 - x /c).
The last two commits are of interest.