Slight math optimizations
Merge pull request #675 from tschneidereit/master

Slight math optimizations